public SelectButton(float xpos, float ypos, ProfileBox2 box) : base(xpos, ypos) { this.graphic = new Sprite("selectButtonAssembly"); this._box = box; this.depth = new Depth(0.2f); this.center = new Vec2(8f, 8f); this._button = new Sprite("selectButton"); this._button.CenterOrigin(); this._collisionOffset = new Vec2(-6f, -3f); this._collisionSize = new Vec2(12f, 12f); }
public void MakeHatSelector(Duck d) { if (this._profileBox != null || d == null) { return; } this._profileBox = new ProfileBox2(9999f, 9999f, d.inputProfile, d.profile, (TeamSelect2)null, 0); this._profileBox.duck = d; this._profileBox._hatSelector.layer = Layer.HUD; this._profileBox._hatSelector.isArcadeHatSelector = true; this._profile = d.profile; this._duck = d; Level.Add((Thing)this._profileBox); }
public void ReplaceHat(TeamHat teamHat, TeamHat newHat) { if (teamHat == null || teamSpawnsDone.ContainsKey(teamHat) || Level.current == null ) { //|| !(Level.current is GameLevel //|| Level.current is Editor // || Level.current is TeamSelect2)) //throw new Exception("DUCKZ!" + Level.current.ToString()); return; } //throw new Exception("Attempted to replace a hat! " + teamHat.team.hat.texture.textureName); if (teamHat.isServerForObject) { Level.Add(newHat); Duck d = teamHat.equippedDuck; if (d != null) { d.Equip(newHat, false); d.Fondle(newHat); TeamSelect2 lobby = Level.current as TeamSelect2; if (lobby != null) { ProfileBox2 box = lobby.GetBox(d.PlayerIndex()); box._hatSelector.hat = newHat; } } } Level.Remove(teamHat); teamSpawnsDone.Add(teamHat, null); }
static bool Prefix(TeamSelect2 __instance) { // TO IMPLEMENT //++Global.data.bootedSinceUpdate; //Global.Save(); // TO IMPLEMENT List <DuckPersona> personas = Persona.all as List <DuckPersona>; // Get the private fields by reflection Type teamselect2type = typeof(TeamSelect2); dynamic littleFont = teamselect2type.GetField("_littleFont", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic countdownScreen = teamselect2type.GetField("_countdownScreen", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic countdown = teamselect2type.GetField("_countdown", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic profiles = teamselect2type.GetField("_profiles", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic font = teamselect2type.GetField("_font", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic buttons = teamselect2type.GetField("_buttons", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic beam = teamselect2type.GetField("_beam", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic configGroup = teamselect2type.GetField("_configGroup", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic multiplayerMenu = teamselect2type.GetField("_multiplayerMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic modifierMenu = teamselect2type.GetField("_modifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic levelSelectMenu = teamselect2type.GetField("_levelSelectMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic playOnlineGroup = teamselect2type.GetField("_playOnlineGroup", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic playOnlineMenu = teamselect2type.GetField("_playOnlineMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic hostGameMenu = teamselect2type.GetField("_hostGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic browseGamesMenu = teamselect2type.GetField("_browseGamesMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic miniHostGameMenu = teamselect2type.GetField("_miniHostGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic joinGameMenu = teamselect2type.GetField("_joinGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic filtersMenu = teamselect2type.GetField("_filtersMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic filterModifierMenu = teamselect2type.GetField("_filterModifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic matchmaker = teamselect2type.GetField("_matchmaker", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic hostGameSettingsMenu = teamselect2type.GetField("_hostGameSettingsMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic hostGameModifierMenu = teamselect2type.GetField("_hostGameModifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic createGame = teamselect2type.GetField("_createGame", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); dynamic hostGame = teamselect2type.GetField("_hostGame", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance); // End of getting fields TeamSelect2.customLevels = TeamSelect2.prevCustomLevels = 0; if (!Network.isActive) { Level.core.gameInProgress = false; } if (!Level.core.gameInProgress) { Main.ResetMatchStuff(); Main.ResetGameStuff(); DuckNetwork.ClosePauseMenu(); } else { ConnectionStatusUI.Hide(); if (Network.isServer) { if (Steam.lobby != null) { Steam.lobby.SetLobbyData("started", "false"); Steam.lobby.joinable = true; } DuckNetwork.inGame = false; foreach (Profile profile in DuckNetwork.profiles) { if (profile.connection == null && profile.slotType != SlotType.Reserved) { profile.slotType = SlotType.Closed; } } } } if (Network.isActive && Network.isServer) { DuckNetwork.ChangeSlotSettings(); } littleFont = new BitmapFont("smallBiosFontUI", 7, 5); countdownScreen = new Sprite("title/wideScreen", 0.0f, 0.0f); __instance.backgroundColor = Color.Black; DuckNetwork.levelIndex = (byte)0; if (Network.isActive && Network.isServer) { GhostManager.context.SetGhostIndex((NetIndex16)32); } countdown = new SpriteMap("countdown", 32, 32, false); countdown.center = new Vec2(16f, 16f); Profile defaultProfile1 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x => { if (x.team != null) { return(x.persona == Persona.Duck1); } return(false); })) ?? Profiles.DefaultPlayer1; Profile defaultProfile2 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x => { if (x.team != null) { return(x.persona == Persona.Duck2); } return(false); })) ?? Profiles.DefaultPlayer2; Profile defaultProfile3 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x => { if (x.team != null) { return(x.persona == Persona.Duck3); } return(false); })) ?? Profiles.DefaultPlayer3; Profile defaultProfile4 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x => { if (x.team != null) { return(x.persona == Persona.Duck4); } return(false); })) ?? Profiles.DefaultPlayer4; Profile defaultProfile5 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x => { if (x.team != null) { return(x.persona == personas[4]); } return(false); })) ?? Profiles.core.all.ElementAt(4); Profile defaultProfile6 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x => { if (x.team != null) { return(x.persona == personas[5]); } return(false); })) ?? Profiles.core.all.ElementAt(5); Profile defaultProfile7 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x => { if (x.team != null) { return(x.persona == personas[6]); } return(false); })) ?? Profiles.core.all.ElementAt(6); Profile defaultProfile8 = Profiles.all.FirstOrDefault <Profile>((Func <Profile, bool>)(x => { if (x.team != null) { return(x.persona == personas[7]); } return(false); })) ?? Profiles.core.all.ElementAt(7); float xpos = 1f; ProfileBox2 profileBox2_1 = new ProfileBox2(xpos, 1f, InputProfile.Get("MPPlayer1"), defaultProfile1, __instance, 0); profiles.Add(profileBox2_1); Level.Add((Thing)profileBox2_1); ProfileBox2 profileBox2_2 = new ProfileBox2(xpos + 119f, 1f, InputProfile.Get("MPPlayer2"), defaultProfile2, __instance, 1); profiles.Add(profileBox2_2); Level.Add((Thing)profileBox2_2); ProfileBox2 profileBox2_3 = new ProfileBox2(xpos + 238f, 1f, InputProfile.Get("MPPlayer3"), defaultProfile3, __instance, 2); profiles.Add(profileBox2_3); Level.Add((Thing)profileBox2_3); ProfileBox2 profileBox2_4 = new ProfileBox2(xpos, 62f, InputProfile.Get("MPPlayer4"), defaultProfile4, __instance, 3); profiles.Add(profileBox2_4); Level.Add((Thing)profileBox2_4); ProfileBox2 profileBox2_5 = new ProfileBox2(xpos + 238f, 62f, InputProfile.Get("MPPlayer5"), defaultProfile5, __instance, 4); profiles.Add(profileBox2_5); Level.Add((Thing)profileBox2_5); ProfileBox2 profileBox2_6 = new ProfileBox2(xpos, 121f, InputProfile.Get("MPPlayer6"), defaultProfile6, __instance, 5); profiles.Add(profileBox2_6); Level.Add((Thing)profileBox2_6); ProfileBox2 profileBox2_7 = new ProfileBox2(xpos + 119f, 121f, InputProfile.Get("MPPlayer7"), defaultProfile7, __instance, 6); profiles.Add(profileBox2_7); Level.Add((Thing)profileBox2_7); ProfileBox2 profileBox2_8 = new ProfileBox2(xpos + 238f, 121f, InputProfile.Get("MPPlayer8"), defaultProfile8, __instance, 7); profiles.Add(profileBox2_8); Level.Add((Thing)profileBox2_8); Saxaphone spicySax = new Saxaphone(160f, 100f); spicySax.infinite = true; Level.Add(spicySax); if (Network.isActive) { __instance.PrepareForOnline(); } else { __instance.BuildPauseMenu(false); } font = new BitmapFont("biosFont", 8, -1); font.scale = new Vec2(1f, 1f); buttons = new SpriteMap("buttons", 14, 14, false); buttons.CenterOrigin(); buttons.depth = (Depth)0.9f; Music.Play("CharacterSelect", true, 0.0f); beam = new TeamBeam(101f, 0.0f); Level.Add((Thing)beam); beam = new TeamBeam(219f, 0.0f); Level.Add((Thing)beam); TeamSelect2.UpdateModifierStatus(); configGroup = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f); multiplayerMenu = new UIMenu("@LWING@MATCH SETTINGS@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST @SELECT@SELECT", (InputProfile)null, false); modifierMenu = new UIMenu("MODIFIERS", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 240f, -1f, "@DPAD@ADJUST @QUACK@BACK", (InputProfile)null, false); levelSelectMenu = (UIMenu) new LevelSelectCompanionMenu(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, multiplayerMenu); foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Modifier)) { if (unlock.unlocked) { modifierMenu.Add((UIComponent) new UIMenuItemToggle(unlock.shortName, (UIMenuAction)null, new FieldBinding((object)unlock, "enabled", 0.0f, 1f, 0.1f), new Color(), (FieldBinding)null, (List <string>)null, false, false), true); } else { modifierMenu.Add((UIComponent) new UIMenuItem("@TINYLOCK@LOCKED", (UIMenuAction)null, UIAlign.Center, Color.Red, false), true); } } modifierMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); modifierMenu.Add((UIComponent) new UIMenuItem("OK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)modifierMenu, (UIComponent)multiplayerMenu), UIAlign.Center, new Color(), true), true); modifierMenu.Close(); foreach (MatchSetting matchSetting in TeamSelect2.matchSettings) { if (!(matchSetting.id == "workshopmaps") || Network.available) { multiplayerMenu.AddMatchSetting(matchSetting, false, true); } } multiplayerMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); multiplayerMenu.Add((UIComponent) new UIModifierMenuItem((UIMenuAction) new UIMenuActionOpenMenu((UIComponent)multiplayerMenu, (UIComponent)modifierMenu), UIAlign.Center, new Color(), false), true); multiplayerMenu.Add((UIComponent) new UICustomLevelMenu((UIMenuAction) new UIMenuActionOpenMenu((UIComponent)multiplayerMenu, (UIComponent)levelSelectMenu), UIAlign.Center, new Color(), false), true); multiplayerMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); multiplayerMenu.Add((UIComponent) new UIMenuItem("OK", (UIMenuAction) new UIMenuActionCloseMenu(configGroup), UIAlign.Center, new Color(), true), true); multiplayerMenu.Close(); configGroup.Add((UIComponent)multiplayerMenu, false); configGroup.Add((UIComponent)modifierMenu, false); configGroup.Add((UIComponent)levelSelectMenu, false); configGroup.Close(); Level.Add((Thing)configGroup); playOnlineGroup = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f); playOnlineMenu = new UIMenu("@PLANET@PLAY ONLINE@PLANET@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST @SELECT@SELECT", (InputProfile)null, false); hostGameMenu = new UIMenu("@LWING@CREATE GAME@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST @SELECT@SELECT", (InputProfile)null, false); browseGamesMenu = (UIMenu) new UIServerBrowser(playOnlineMenu, "SERVER BROWSER", Layer.HUD.camera.width, Layer.HUD.camera.height, 550f, -1f, "@DPAD@@SELECT@JOIN @SHOOT@REFRESH @QUACK@BACK", (InputProfile)null); miniHostGameMenu = new UIMenu("@LWING@HOST GAME@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST @SELECT@SELECT", (InputProfile)null, false); joinGameMenu = new UIMenu("@LWING@FIND GAME@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST @SELECT@SELECT", (InputProfile)null, false); filtersMenu = new UIMenu("@LWING@FILTERS@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@SELECT@SELECT @GRAB@TYPE", (InputProfile)null, false); filterModifierMenu = new UIMenu("@LWING@FILTER MODIFIERS@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 240f, -1f, "@DPAD@ADJUST @SELECT@SELECT", (InputProfile)null, false); matchmaker = new UIMatchmakingBox(joinGameMenu, Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f); hostGameSettingsMenu = new UIMenu("@LWING@SETTINGS@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST @SELECT@SELECT", (InputProfile)null, false); hostGameModifierMenu = new UIMenu("@LWING@MODIFIERS@RWING@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 240f, -1f, "@DPAD@ADJUST @SELECT@SELECT", (InputProfile)null, false); if ((string)typeof(ModLoader).GetProperty("modHash", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null, null) != "nomods") { playOnlineMenu.Add((UIComponent) new UIMenuItem("FIND GAME", (UIMenuAction) new UIMenuActionCloseMenuCallFunction((UIComponent)playOnlineMenu, new UIMenuActionCloseMenuCallFunction.Function(__instance.OpenNoModsFindGame)), UIAlign.Center, new Color(), false), true); playOnlineMenu.Add((UIComponent) new UIMenuItem("CREATE GAME", (UIMenuAction) new UIMenuActionCloseMenuCallFunction((UIComponent)playOnlineMenu, new UIMenuActionCloseMenuCallFunction.Function(__instance.OpenNoModsCreateGame)), UIAlign.Center, new Color(), false), true); } else { playOnlineMenu.Add((UIComponent) new UIMenuItem("FIND GAME", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)playOnlineMenu, (UIComponent)joinGameMenu), UIAlign.Center, new Color(), false), true); playOnlineMenu.Add((UIComponent) new UIMenuItem("CREATE GAME", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)playOnlineMenu, (UIComponent)hostGameMenu), UIAlign.Center, new Color(), false), true); } playOnlineMenu.Add((UIComponent) new UIMenuItem("BROWSE GAMES", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)playOnlineMenu, (UIComponent)browseGamesMenu), UIAlign.Center, new Color(), false), true); playOnlineMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); playOnlineMenu.Add((UIComponent) new UIMenuItem("CANCEL", (UIMenuAction) new UIMenuActionCloseMenuCallFunction(playOnlineGroup, new UIMenuActionCloseMenuCallFunction.Function(__instance.ClosedOnline)), UIAlign.Center, new Color(), true), true); playOnlineMenu.Close(); playOnlineGroup.Add((UIComponent)playOnlineMenu, false); foreach (MatchSetting onlineSetting in TeamSelect2.onlineSettings) { if (!onlineSetting.filterOnly) { hostGameMenu.AddMatchSetting(onlineSetting, false, true); } } hostGameMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); hostGameMenu.Add((UIComponent) new UIMenuItem("CREATE GAME", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(playOnlineGroup, createGame), UIAlign.Center, new Color(), false), true); hostGameMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)hostGameMenu, (UIComponent)playOnlineMenu), UIAlign.Center, new Color(), true), true); hostGameMenu.Close(); browseGamesMenu.Close(); playOnlineGroup.Add((UIComponent)browseGamesMenu, false); playOnlineGroup.Add((UIComponent)hostGameMenu, false); miniHostGameMenu.AddMatchSetting(TeamSelect2.GetOnlineSetting("type"), false, true); miniHostGameMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); miniHostGameMenu.Add((UIComponent) new UIMenuItem("HOST GAME", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean((UIComponent)miniHostGameMenu, hostGame), UIAlign.Center, new Color(), false), true); miniHostGameMenu.Add((UIComponent) new UIMenuItem("CANCEL", (UIMenuAction) new UIMenuActionCloseMenu((UIComponent)miniHostGameMenu), UIAlign.Center, new Color(), true), true); miniHostGameMenu.Close(); Level.Add((Thing)miniHostGameMenu); foreach (MatchSetting onlineSetting in TeamSelect2.onlineSettings) { if (!onlineSetting.createOnly) { joinGameMenu.AddMatchSetting(onlineSetting, true, true); } } joinGameMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); joinGameMenu.Add((UIComponent) new UIMenuItem("FIND GAME", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)joinGameMenu, (UIComponent)matchmaker), UIAlign.Center, new Color(), false), true); joinGameMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)joinGameMenu, (UIComponent)playOnlineMenu), UIAlign.Center, new Color(), true), true); joinGameMenu.Close(); playOnlineGroup.Add((UIComponent)joinGameMenu, false); foreach (MatchSetting matchSetting in TeamSelect2.matchSettings) { if (!(matchSetting.id == "workshopmaps") || Network.available) { filtersMenu.AddMatchSetting(matchSetting, true, true); } } filtersMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); filtersMenu.Add((UIComponent) new UIModifierMenuItem((UIMenuAction) new UIMenuActionOpenMenu((UIComponent)filtersMenu, (UIComponent)filterModifierMenu), UIAlign.Center, new Color(), false), true); filtersMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); filtersMenu.Add((UIComponent) new UIMenuItem("|DGBLUE|CLEAR FILTERS", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(__instance.ClearFilters)), UIAlign.Center, new Color(), false), true); filtersMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)filtersMenu, (UIComponent)joinGameMenu), UIAlign.Center, new Color(), true), true); filtersMenu.Close(); playOnlineGroup.Add((UIComponent)filtersMenu, false); foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Modifier)) { filterModifierMenu.Add((UIComponent) new UIMenuItemToggle(unlock.shortName, (UIMenuAction)null, new FieldBinding((object)unlock, "enabled", 0.0f, 1f, 0.1f), new Color(), new FieldBinding((object)unlock, "filtered", 0.0f, 1f, 0.1f), (List <string>)null, false, false), true); } filterModifierMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); filterModifierMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)filterModifierMenu, (UIComponent)filtersMenu), UIAlign.Center, new Color(), true), true); filterModifierMenu.Close(); playOnlineGroup.Add((UIComponent)filterModifierMenu, false); foreach (MatchSetting matchSetting in TeamSelect2.matchSettings) { if (!(matchSetting.id == "workshopmaps") || Network.available) { hostGameSettingsMenu.AddMatchSetting(matchSetting, false, true); } } hostGameSettingsMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); hostGameSettingsMenu.Add((UIComponent) new UIModifierMenuItem((UIMenuAction) new UIMenuActionOpenMenu((UIComponent)hostGameSettingsMenu, (UIComponent)hostGameModifierMenu), UIAlign.Center, new Color(), false), true); hostGameSettingsMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); hostGameSettingsMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)hostGameSettingsMenu, (UIComponent)hostGameMenu), UIAlign.Center, new Color(), true), true); hostGameSettingsMenu.Close(); playOnlineGroup.Add((UIComponent)hostGameSettingsMenu, false); foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Modifier)) { hostGameModifierMenu.Add((UIComponent) new UIMenuItemToggle(unlock.shortName, (UIMenuAction)null, new FieldBinding((object)unlock, "enabled", 0.0f, 1f, 0.1f), new Color(), (FieldBinding)null, (List <string>)null, false, false), true); } hostGameModifierMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); hostGameModifierMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)hostGameModifierMenu, (UIComponent)hostGameSettingsMenu), UIAlign.Center, new Color(), true), true); hostGameModifierMenu.Close(); playOnlineGroup.Add((UIComponent)hostGameModifierMenu, false); matchmaker.Close(); playOnlineGroup.Add((UIComponent)matchmaker, false); playOnlineGroup.Close(); Level.Add((Thing)playOnlineGroup); Graphics.fade = 0.0f; Layer l = new Layer("HUD2", -85, new Camera(), false, new Vec2()); l.camera.width /= 2f; l.camera.height /= 2f; Layer.Add(l); Layer hud = Layer.HUD; Layer.HUD = l; Editor.gamepadMode = true; Layer.HUD = hud; // Start of setting private fields teamselect2type.GetField("_littleFont", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, littleFont); teamselect2type.GetField("_countdownScreen", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, countdownScreen); teamselect2type.GetField("_countdown", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, countdown); teamselect2type.GetField("_profiles", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, profiles); teamselect2type.GetField("_font", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, font); teamselect2type.GetField("_buttons", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, buttons); teamselect2type.GetField("_beam", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, beam); teamselect2type.GetField("_configGroup", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, configGroup); teamselect2type.GetField("_multiplayerMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, multiplayerMenu); teamselect2type.GetField("_modifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, modifierMenu); teamselect2type.GetField("_levelSelectMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, levelSelectMenu); teamselect2type.GetField("_playOnlineGroup", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, playOnlineGroup); teamselect2type.GetField("_playOnlineMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, playOnlineMenu); teamselect2type.GetField("_hostGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, hostGameMenu); teamselect2type.GetField("_browseGamesMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, browseGamesMenu); teamselect2type.GetField("_miniHostGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, miniHostGameMenu); teamselect2type.GetField("_joinGameMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, joinGameMenu); teamselect2type.GetField("_filtersMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, filtersMenu); teamselect2type.GetField("_filterModifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, filterModifierMenu); teamselect2type.GetField("_matchmaker", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, matchmaker); teamselect2type.GetField("_hostGameSettingsMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, hostGameSettingsMenu); teamselect2type.GetField("_hostGameModifierMenu", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, hostGameModifierMenu); teamselect2type.GetField("_createGame", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, createGame); teamselect2type.GetField("_hostGame", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, hostGame); // End of setting private fields if (DuckNetwork.ShowUserXPGain() || !Unlockables.HasPendingUnlocks()) { return(false); } MonoMain.pauseMenu = (UIComponent) new UIUnlockBox(Unlockables.GetPendingUnlocks().ToList <Unlockable>(), Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f); return(false); }
public Team FilterTeam(bool hardFilter = false) { Team t = null; Profile _profile = DuckNetwork.profiles[profileBoxNumber]; TeamSelect2 current = Level.current as TeamSelect2; ProfileBox2 box = current.GetBox((byte)profileBoxNumber); HatSelector hatSelector = box._hatSelector; if (!Network.isActive) { t = AllTeams()[(int)_desiredTeamSelection]; } int index = (int)_desiredTeamSelection; if (index >= AllTeams().Count) { index = ControllerNumber(); } if (_profile != null && _profile.connection == DuckNetwork.localConnection && !hardFilter) { if (index >= Teams.core.teams.Count) { Team allTeam = AllTeams()[index]; index = ControllerNumber(); } t = AllTeams()[index]; } Team allTeam1; if (_profile.connection == DuckNetwork.localConnection) { if (index >= Teams.core.teams.Count) { Team allTeam2 = AllTeams()[index]; allTeam1 = AllTeams()[ControllerNumber()]; Team.MapFacade(localID, allTeam2); Send.Message((NetMessage) new NMSpecialHat(allTeam2, localID)); } else { allTeam1 = AllTeams()[index]; Team.ClearFacade(_profile.steamID); Send.Message((NetMessage) new NMSpecialHat((Team)null, localID)); } } else { allTeam1 = AllTeams()[index]; } t = allTeam1; if (hardFilter == true) { if (Network.isActive && box.duck != null) { Send.Message(new NMSetTeam(box.duck.profile.networkIndex, (byte)Teams.IndexOf(t))); } if (t.hasHat) { if (box.duck != null) { Hat equipment = box.duck.GetEquipment(typeof(Hat)) as Hat; Hat hat = (Hat) new TeamHat(0.0f, 0.0f, t); Level.Add((Thing)hat); box.duck.Equip((Equipment)hat, false, false); box.duck.Fondle((Thing)hat); if (hatSelector.hat != null) { Level.Remove((Thing)hatSelector.hat); } hatSelector.hat = hat; if (equipment != null) { Level.Remove((Thing)equipment); } } else if (hatSelector.hat != null) { Level.Remove((Thing)hatSelector.hat); } } else { if (hatSelector.hat != null) { Level.Remove((Thing)hatSelector.hat); } hatSelector.hat = (Hat)null; if (box.duck != null) { Hat equipment = box.duck.GetEquipment(typeof(Hat)) as Hat; if (equipment != null) { box.duck.Unequip((Equipment)equipment, false); Level.Remove((Thing)equipment); } } } if (_desiredTeamSelection <= 7) { _desiredTeamSelection = 0; } } return(t); }
public HatConsole(float xpos, float ypos, ProfileBox2 bbox) : base(xpos, ypos) => this.box = bbox;
private void Compare_Click(object sender, EventArgs e) { try { ProfileBox1.Load("http://services.runescape.com/m=avatar-rs/" + PLayerInput1.Text + "/chat.gif"); } catch { ProfileBox1.Load("http://services.runescape.com/m=avatar-rs/default_chat.png?"); } try { ProfileBox2.Load("http://services.runescape.com/m=avatar-rs/" + PlayerInput2.Text + "/chat.gif"); } catch { ProfileBox2.Load("http://services.runescape.com/m=avatar-rs/default_chat.png?"); } try { LevelArray = API.UpdateLevels(PLayerInput1.Text); LevelArray2 = API.UpdateLevels(PlayerInput2.Text); TotalLevel1.Text = LevelArray[1]; TotalLevel2.Text = LevelArray2[1]; PercentLabel1.Text = API.GetLevelPercentage(Convert.ToDecimal(LevelArray[1])).ToString() + "%"; PercentLabel2.Text = API.GetLevelPercentage(Convert.ToDecimal(LevelArray2[1])).ToString() + "%"; AverageLevel1.Text = API.GetMean(LevelArray).ToString(); AverageLevel2.Text = API.GetMean(LevelArray2).ToString(); AttackBar.Value = API.IntParse(LevelArray[5]); DefenceBar.Value = API.IntParse(LevelArray[7]); StrengthBar.Value = API.IntParse(LevelArray[9]); HealthBar.Value = API.IntParse(LevelArray[11]); RangedBar.Value = API.IntParse(LevelArray[13]); PrayerBar.Value = API.IntParse(LevelArray[15]); MagicBar.Value = API.IntParse(LevelArray[17]); WoodcuttingBar.Value = API.IntParse(LevelArray[19]); FletchingBar.Value = API.IntParse(LevelArray[21]); FishingBar.Value = API.IntParse(LevelArray[23]); FiremakingBar.Value = API.IntParse(LevelArray[25]); CraftingBar.Value = API.IntParse(LevelArray[27]); SmithingBar.Value = API.IntParse(LevelArray[29]); MiningBar.Value = API.IntParse(LevelArray[31]); HerbloreBar.Value = API.IntParse(LevelArray[33]); AgilityBar.Value = API.IntParse(LevelArray[35]); ThievingBar.Value = API.IntParse(LevelArray[37]); SlayerBar.Value = API.IntParse(LevelArray[39]); FarmingBar.Value = API.IntParse(LevelArray[41]); RunecraftingBar.Value = API.IntParse(LevelArray[43]); HunterBar.Value = API.IntParse(LevelArray[45]); ConstructionBar.Value = API.IntParse(LevelArray[47]); SummoningBar.Value = API.IntParse(LevelArray[49]); DungeoneeringBar.Value = API.IntParse(LevelArray[51]); DivinationBar.Value = API.IntParse(LevelArray[53]); InventorBar.Value = API.IntParse(LevelArray[55]); //labels AttackLabel.Text = LevelArray[5]; DefenceLabel.Text = LevelArray[7]; StrengthLabel.Text = LevelArray[9]; HealthLabel.Text = LevelArray[11]; RangedLabel.Text = LevelArray[13]; PrayerLabel.Text = LevelArray[15]; MagicLabel.Text = LevelArray[17]; WoodcuttingLabel.Text = LevelArray[19]; FletchingLabel.Text = LevelArray[21]; FishingLabel.Text = LevelArray[23]; FiremakingLabel.Text = LevelArray[25]; CraftingLabel.Text = LevelArray[27]; SmithingLabel.Text = LevelArray[29]; MiningLabel.Text = LevelArray[31]; HerbloreLabel.Text = LevelArray[33]; AgilityLabel.Text = LevelArray[35]; ThievingLabel.Text = LevelArray[37]; SlayerLabel.Text = LevelArray[39]; FarmingLabel.Text = LevelArray[41]; RunecraftingLabel.Text = LevelArray[43]; HunterLabel.Text = LevelArray[45]; ConstructionLabel.Text = LevelArray[47]; SummoningLabel.Text = LevelArray[49]; DungeoneeringLabel.Text = LevelArray[51]; DivinationLabel.Text = LevelArray[53]; InventionLabel.Text = LevelArray[55]; AttackBar2.Value = API.IntParse(LevelArray2[5]); DefenceBar2.Value = API.IntParse(LevelArray2[7]); StrengthBar2.Value = API.IntParse(LevelArray2[9]); HealthBar2.Value = API.IntParse(LevelArray2[11]); RangedBar2.Value = API.IntParse(LevelArray2[13]); PrayerBar2.Value = API.IntParse(LevelArray2[15]); MagicBar2.Value = API.IntParse(LevelArray2[17]); WoodcuttingBar2.Value = API.IntParse(LevelArray2[19]); FletchingBar2.Value = API.IntParse(LevelArray2[21]); FishingBar2.Value = API.IntParse(LevelArray2[23]); FiremakingBar2.Value = API.IntParse(LevelArray2[25]); CraftingBar2.Value = API.IntParse(LevelArray2[27]); SmithingBar2.Value = API.IntParse(LevelArray2[29]); MiningBar2.Value = API.IntParse(LevelArray2[31]); HerbloreBar2.Value = API.IntParse(LevelArray2[33]); AgilityBar2.Value = API.IntParse(LevelArray2[35]); ThievingBar2.Value = API.IntParse(LevelArray2[37]); SlayerBar2.Value = API.IntParse(LevelArray2[39]); FarmingBar2.Value = API.IntParse(LevelArray2[41]); RunecraftingBar2.Value = API.IntParse(LevelArray2[43]); HunterBar2.Value = API.IntParse(LevelArray2[45]); ConstructionBar2.Value = API.IntParse(LevelArray2[47]); SummoningBar2.Value = API.IntParse(LevelArray2[49]); DungeoneeringBar2.Value = API.IntParse(LevelArray2[51]); DivinationBar2.Value = API.IntParse(LevelArray2[53]); InventorBar2.Value = API.IntParse(LevelArray2[55]); //labels AttackLabel2.Text = LevelArray2[5]; DefenceLabel2.Text = LevelArray2[7]; StrengthLabel2.Text = LevelArray2[9]; HealthLabel2.Text = LevelArray2[11]; RangedLabel2.Text = LevelArray2[13]; PrayerLabel2.Text = LevelArray2[15]; MagicLabel2.Text = LevelArray2[17]; WoodcuttingLabel2.Text = LevelArray2[19]; FletchingLabel2.Text = LevelArray2[21]; FishingLabel2.Text = LevelArray2[23]; FiremakingLabel2.Text = LevelArray2[25]; CraftingLabel2.Text = LevelArray2[27]; SmithingLabel2.Text = LevelArray2[29]; MiningLabel2.Text = LevelArray2[31]; HerbloreLabel2.Text = LevelArray2[33]; AgilityLabel2.Text = LevelArray2[35]; ThievingLabel2.Text = LevelArray2[37]; SlayerLabel2.Text = LevelArray2[39]; FarmingLabel2.Text = LevelArray2[41]; RunecraftingLabel2.Text = LevelArray2[43]; HunterLabel2.Text = LevelArray2[45]; ContructionLabel2.Text = LevelArray2[47]; SummoningLabel2.Text = LevelArray2[49]; DungeoneeringLabel2.Text = LevelArray2[51]; DivinationLabel2.Text = LevelArray2[53]; InventionLabel2.Text = LevelArray2[55]; Cursor.Current = Cursors.Default; } catch { } }
// We are hooking this because loads of stuff in Initialize is either private or internal so I'm adding stuff to the calls it does public static void UpdateModifierStatus() { // Extra stuff here - Very dangerous + slow. Need better method StackFrame frame = new StackFrame(1); var method = frame.GetMethod(); var type = method.DeclaringType; var name = method.Name; if (name == "Initialize" && type == typeof(TeamSelect2)) { List <DuckPersona> _personas = typeof(Persona).GetField("_personas", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public).GetValue(null) as List <DuckPersona>; FieldInfo _profilesField = typeof(TeamSelect2).GetField("_profiles", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); dynamic _profiles = _profilesField.GetValue(Level.current as TeamSelect2); Profile defaultProfile5 = Profiles.all.FirstOrDefault(x => { if (x.team != null) { return(x.persona == _personas[4]); } return(false); }) ?? Profiles.core.all.ElementAt(4); Profile defaultProfile6 = Profiles.all.FirstOrDefault(x => { if (x.team != null) { return(x.persona == _personas[5]); } return(false); }) ?? Profiles.core.all.ElementAt(5); Profile defaultProfile7 = Profiles.all.FirstOrDefault(x => { if (x.team != null) { return(x.persona == _personas[6]); } return(false); }) ?? Profiles.core.all.ElementAt(6); Profile defaultProfile8 = Profiles.all.FirstOrDefault(x => { if (x.team != null) { return(x.persona == _personas[7]); } return(false); }) ?? Profiles.core.all.ElementAt(7); float xpos = 1f; ProfileBox2 profileBox2_5 = new ProfileBox2(xpos, 180f, InputProfile.Get("MPPlayer5"), defaultProfile5, (TeamSelect2)Level.current, 4); _profiles.Add(profileBox2_5); Level.Add(profileBox2_5); ProfileBox2 profileBox2_6 = new ProfileBox2(xpos + 178f, 180f, InputProfile.Get("MPPlayer6"), defaultProfile6, (TeamSelect2)Level.current, 5); _profiles.Add(profileBox2_6); Level.Add(profileBox2_6); ProfileBox2 profileBox2_7 = new ProfileBox2(xpos, 270f, InputProfile.Get("MPPlayer7"), defaultProfile7, (TeamSelect2)Level.current, 6); _profiles.Add(profileBox2_7); Level.Add(profileBox2_7); ProfileBox2 profileBox2_8 = new ProfileBox2(xpos + 178f, 270f, InputProfile.Get("MPPlayer8"), defaultProfile8, (TeamSelect2)Level.current, 7); _profiles.Add(profileBox2_8); Level.Add(profileBox2_8); // Expand the view and tweak boxes Level.current.camera = new Camera(0f, 0f, -1f, (Graphics.height / 2f)); Layer.HUD.camera = new Camera(0f, 0f, -1f, (Graphics.height / 2f)); if (Network.isActive) { (Level.current as TeamSelect2).PrepareForOnline(); } } // Normal stuff here Type typea = typeof(TeamSelect2); FieldInfo info2 = typea.GetField("_modifierStatus", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); Dictionary <string, bool> _modifierStatus = info2.GetValue(Level.current) as Dictionary <string, bool>; bool flag = false; foreach (UnlockData unlock in Unlocks.GetUnlocks(UnlockType.Modifier)) { _modifierStatus[unlock.id] = false; if (unlock.enabled) { flag = true; _modifierStatus[unlock.id] = true; } } if (!Network.isActive || !Network.isServer || Steam.lobby == null) { return; } Steam.lobby.SetLobbyData("modifiers", flag ? "true" : "false"); }