public void Test_TotalSize_and_Length_of_title1() { UIMenu mainMenu = new UIMenu("mainMenu"); UITitle title1 = new UITitle("title 1"); UIMenu menu1 = new UIMenu("menu 1"); mainMenu.Add(title1); mainMenu.Add(menu1); title1.Display.TotalSize.Should().Be(title1.GetText().ToString().Length); }
public static void Main() { var mainMenu = new UIMenu("Main Menu") { Parent = Component.MainComponent }; var mainTitle = new UITitle("LIDAR - MENU PRINCIPAL"); mainMenu.Add(mainTitle); var manageScans = new UIMenu("Gérer les scans"); mainMenu.Add(manageScans); var manageScansTitle = new UITitle("LIDAR - GÉRER SCANS"); manageScans.Add(manageScansTitle); var addScan = new UIMenu("Ajouter un scan"); manageScans.Add(addScan); var addScanTitle = new UITitle("LIDAR - AJOUTER UN SCAN"); addScan.Add(addScanTitle); var addExposition = new UIMenu("Ajouter une exposition"); addScan.Add(addExposition); var addExpTitle = new UITitle("LIDAR - AJOUTER EXPOSITION"); addExposition.Add(addExpTitle); var addExpTime = new UIValueChangerInt("Temps", 1); addExposition.Add(addExpTime); var addStream = new UIMenu("Ajouter une raffale"); addScan.Add(addStream); var addStrmTitle = new UITitle("LIDAR - AJOUTER RAFFALE"); addStream.Add(addStrmTitle); var modifyScan = new UIMenu("Modifier un scan"); manageScans.Add(modifyScan); var modifScanTitle = new UITitle("LIDAR - MODIFIER SCAN"); modifyScan.Add(modifScanTitle); Component.Current = manageScans; while (true) { //Console.WriteLine(Component.Current.Name); Component.Current.Show(); ConsoleKeyInfo key = Console.ReadKey(); switch (key.Key) { case ConsoleKey.UpArrow: Component.Current.Up(); break; case ConsoleKey.DownArrow: Component.Current.Down(); break; case ConsoleKey.LeftArrow: Component.Current.Back(); break; case ConsoleKey.RightArrow: Component.Current.Select(); break; case ConsoleKey.Enter: return; default: break; } Console.Clear(); } }
public void Test_equal_TotalSize() { var testDisplay = new TestDisplay(); UIMenu mainMenu = new UIMenu("mainMenu", testDisplay); UITitle title1 = new UITitle("title 1"); UIMenu menu1 = new UIMenu("menu 1"); mainMenu.Add(title1); mainMenu.Add(menu1); mainMenu.Print(); title1.Display.TotalSize.Should().Be(menu1.Display.TotalSize); }
public void Test_equal_Length() { var testDisplay = new TestDisplay(); UIMenu mainMenu = new UIMenu("mainMenu", testDisplay); UITitle title1 = new UITitle("title 1"); UIMenu menu1 = new UIMenu("menu 1"); mainMenu.Add(title1); mainMenu.Add(menu1); mainMenu.Print(); title1.GetText().ToString().Length.Should().Be(menu1.GetText().ToString().Length); }
public override void Initialize() { this.camera.x = 480f; UIMenu uiMenu = new UIMenu("MULTIPLAYER", (float)Graphics.width / 2f, (float)Graphics.height / 2f, 160f); uiMenu.scale = new Vec2(4f); uiMenu.Add((UIComponent) new UIMenuItemNumber("ROUNDS PER SET", field: new FieldBinding((object)this, "roundsPerSet", max: 50f)), true); uiMenu.Add((UIComponent) new UIMenuItemNumber("SETS PER GAME", field: new FieldBinding((object)this, "setsPerGame", max: 50f)), true); uiMenu.Add((UIComponent) new UIText(" ", Color.White), true); uiMenu.Add((UIComponent) new UIMenuItem("START", (UIMenuAction) new UIMenuActionChangeLevel((UIComponent)uiMenu, (Level) new TeamSelect2())), true); uiMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionChangeLevel((UIComponent)uiMenu, (Level) new TitleScreen())), true); Level.Add((Thing)uiMenu); base.Initialize(); }
// Populate droid menu private static void populateMenus() { // Populate droid menu GeneralDroidMenu.Add(new Label(UIElement.EDisplaySetting.BLOCK, "DROID CONFIGURATION MENU")); GeneralDroidMenu.Add(new Spacer()); GeneralDroidMenu.Add(new Label(UIElement.EDisplaySetting.BLOCK, "Left and Right arrow keys: navigate through menu")); GeneralDroidMenu.Add(new Label(UIElement.EDisplaySetting.BLOCK, "Up and Down arrow keys: select from choices")); GeneralDroidMenu.Add(new Label(UIElement.EDisplaySetting.BLOCK, "Enter key: activates button")); GeneralDroidMenu.Add(new Spacer()); GeneralDroidMenu.Add(new Label(UIElement.EDisplaySetting.BLOCK, "General Droid Configuration")); GeneralDroidMenu.Add(new Spacer()); GeneralDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Material:", Enum.GetNames(typeof(Droid.DroidMaterial)))); GeneralDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Color:", Enum.GetNames(typeof(Droid.DroidColor)))); GeneralDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Model:", Enum.GetNames(typeof(Droid.DroidModel)))); GeneralDroidMenu.Add(new Spacer(1)); GeneralDroidMenu.Add(new Button(UIElement.EDisplaySetting.BLOCK, "Submit")); // Populate protocol droid menu ProtocolDroidMenu.Add(new Label(UIElement.EDisplaySetting.BLOCK, "PROTOCOL DROID CONFIGURATION")); ProtocolDroidMenu.Add(new Spacer()); ProtocolDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Number of languages:", getNumberArray(1, 20))); ProtocolDroidMenu.Add(new Spacer(1)); ProtocolDroidMenu.Add(new Button(UIElement.EDisplaySetting.BLOCK, "Submit")); // Populate utility droid menu UtilityDroidMenu.Add(new Label(UIElement.EDisplaySetting.BLOCK, "UTILITY DROID CONFIGURATION")); UtilityDroidMenu.Add(new Spacer()); UtilityDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Toolbox:", getTrueFalseChoices())); UtilityDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Computer Connection:", getTrueFalseChoices())); UtilityDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Arm:", getTrueFalseChoices())); UtilityDroidMenu.Add(new Spacer()); UtilityDroidMenu.Add(new Button(UIElement.EDisplaySetting.BLOCK, "Submit")); // Populate Janitor Droid Menu JanitorDroidMenu.Add(new Label(UIElement.EDisplaySetting.BLOCK, "JANITOR UTILITY DROID CONFIGURATION")); JanitorDroidMenu.Add(new Spacer()); JanitorDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Trash Compactor:", getTrueFalseChoices())); JanitorDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Vacuum:", getTrueFalseChoices())); JanitorDroidMenu.Add(new Spacer(1)); JanitorDroidMenu.Add(new Button(UIElement.EDisplaySetting.BLOCK, "Submit")); // Populate Astromech Droid Menu AstromechDroidMenu.Add(new Label(UIElement.EDisplaySetting.BLOCK, "ASTROMECH UTILITY DROID CONFIGURATION")); AstromechDroidMenu.Add(new Spacer()); AstromechDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Fire Extinguisher:", getTrueFalseChoices())); AstromechDroidMenu.Add(new SelectionBox(UIElement.EDisplaySetting.INLINE, "Number of ships:", getNumberArray(0, 20))); AstromechDroidMenu.Add(new Spacer(1)); AstromechDroidMenu.Add(new Button(UIElement.EDisplaySetting.BLOCK, "Submit")); }
public static void Initialize() { Type type = typeof(Duck); var assembly = Assembly.GetAssembly(type); var OptionsType = assembly.GetType("DuckGame.Options"); dynamic optionsMenu = OptionsType.GetField("_optionsMenu", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); dynamic optionsData = OptionsType.GetField("_data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); Injection.install(8, "UpdateLevelChange", "UpdateLevelChangeReplace"); optionsMenu = new UIMenu("@WRENCH@OPTIONS@SCREWDRIVER@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f, -1f, "@DPAD@ADJUST @QUACK@BACK", (InputProfile)null, false); optionsMenu.Add((UIComponent) new UIMenuItemSlider("SFX VOLUME", (UIMenuAction)null, new FieldBinding((object)optionsData, "sfxVolume", 0.0f, 1f, 0.1f), 0.125f, new Color()), true); optionsMenu.Add((UIComponent) new UIMenuItemSlider("MUSIC VOLUME", (UIMenuAction)null, new FieldBinding((object)optionsData, "musicVolume", 0.0f, 1f, 0.1f), 0.125f, new Color()), true); optionsMenu.Add((UIComponent) new UIMenuItemToggle("SHENANIGANS", (UIMenuAction)null, new FieldBinding((object)optionsData, "shennanigans", 0.0f, 1f, 0.1f), new Color(), (FieldBinding)null, (List <string>)null, false, false), true); optionsMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); optionsMenu.Add((UIComponent) new UIMenuItemToggle("FULLSCREEN", (UIMenuAction)null, new FieldBinding((object)optionsData, "fullscreen", 0.0f, 1f, 0.1f), new Color(), (FieldBinding)null, (List <string>)null, false, false), true); optionsMenu.Add((UIComponent) new UIText(" ", Color.White, UIAlign.Center, 0.0f, (InputProfile)null), true); optionsMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionCloseMenuCallFunction((UIComponent)optionsMenu, new UIMenuActionCloseMenuCallFunction.Function(OptionsEdits.close)), UIAlign.Center, new Color(), true), true); FieldInfo test = OptionsType.GetField("_optionsMenu", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); test.SetValue(null, optionsMenu); optionsMenu.Close(); }
public void Test_TotalSize_and_Length_of_menu1() { var testDisplay = new TestDisplay(); UIMenu mainMenu = new UIMenu("mainMenu", testDisplay); UITitle title1 = new UITitle("title 1"); UIMenu menu1 = new UIMenu("menu 1"); UIMenu menu2 = new UIMenu("me 1"); mainMenu.Add(title1); mainMenu.Add(menu1); mainMenu.Add(menu2); mainMenu.Print(); //testDisplay.Lines[0].Length.Should().Be(9); testDisplay.Lines[1].Length.Should().Be(9); testDisplay.Lines[2].Length.Should().Be(9); }
public static async void OpenStatsViewer(Profile p, UIMenu closeThereFrom) { try { string s = await statsWork.client.GetStringAsync(statsWork.wepAppAdress + "stats\\" + p.steamID); if (s == "" || s[0] == '8') { DuckStatsNotification.ShowNotification("This Duck Has Not Uploaded His Stats"); } else { Dictionary <string, string> stats = JsonConvert.DeserializeObject <Dictionary <string, string> >(s); statsMenu = new UIMenu("@PLANET@" + p.name + "'s Stats@PLANET@", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, -1, -1); foreach (KeyValuePair <string, string> kv in stats) { UIText i = new UIText(kv.Key + " |GRAY|: |DGBLUE|" + kv.Value, Color.Yellow); i.scale = new Vec2(statScale, statScale); i.collisionSize *= statScale; statsMenu.Add(i); } statsMenu.SetBackFunction(new UIMenuActionCallFunction(delegate() { CloseStatsViewer(p); })); closeThereFrom?.Close(); statsMenu.Resize(); MonoMain.pauseMenu = statsMenu; statsMenu.Open(); Level.Add(statsMenu); } } catch { DuckStatsNotification.ShowNotification("@UNPLUG@ERROR viewing stats! Better Tell Ziggy!", Color.Red); CloseStatsViewer(p); return; } }
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 override void Initialize() { Layer.Add((Layer) new GridBackground("GRID", 99999)); this._font = new BitmapFont("duckFont", 8); this._font.scale = new Vec2(2f, 2f); Gun gun = (Gun) new Saxaphone(0.0f, 0.0f); gun.scale = new Vec2(2f, 2f); UIMenu uiMenu = new UIMenu(gun.editorName, Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 220f); UIBox uiBox1 = new UIBox(false, false); UIImage uiImage = new UIImage(gun.GetEditorImage(64, 64, true)); uiImage.collisionSize = new Vec2(64f, 32f); uiBox1.Add((UIComponent)uiImage, true); UIBox uiBox2 = new UIBox(isVisible: false); uiBox2.Add((UIComponent) new UIText("AMMO: " + (gun.ammo > 900 ? "INFINITE" : gun.ammo.ToString()), Color.White, UIAlign.Left), true); string str1 = "SHORT"; if ((double)gun.ammoType.range > 150.0) { str1 = "MEDIUM"; } if ((double)gun.ammoType.range > 300.0) { str1 = "LONG"; } if ((double)gun.ammoType.range > 600.0) { str1 = "EXTREME"; } uiBox2.Add((UIComponent) new UIText("RANGE: " + str1, Color.White, UIAlign.Left), true); if ((double)gun.ammoType.penetration > 0.0) { uiBox2.Add((UIComponent) new UIText("PENETRATION: " + (object)gun.ammoType.penetration, Color.White, UIAlign.Left), true); } else { uiBox2.Add((UIComponent) new UIText("SPECIAL AMMO", Color.White, UIAlign.Left), true); } uiBox1.Add((UIComponent)uiBox2, true); uiMenu.Add((UIComponent)uiBox1, true); UIBox uiBox3 = new UIBox(isVisible: false); uiBox3.Add((UIComponent) new UIText("---------------------", Color.White), true); float num = 190f; string str2 = gun.bio; string textVal = ""; string str3 = ""; while (true) { if (str2.Length > 0 && str2[0] != ' ') { str3 += (string)(object)str2[0]; } else { if ((double)((textVal.Length + str3.Length) * 8) > (double)num) { uiBox3.Add((UIComponent) new UIText(textVal, Color.White), true); textVal = ""; } if (textVal.Length > 0) { textVal += " "; } textVal += str3; str3 = ""; } if (str2.Length != 0) { str2 = str2.Remove(0, 1); } else { break; } } if (str3.Length > 0) { if (textVal.Length > 0) { textVal += " "; } textVal += str3; } if (textVal.Length > 0) { uiBox3.Add((UIComponent) new UIText(textVal, Color.White), true); } uiMenu.Add((UIComponent)uiBox3, true); Level.Add((Thing)uiMenu); }
static void Main(string[] args) { var mainMenu = new UIMenu("Main Menu") { Parent = Component.MainComponent }; { var mainTitle = new UITitle("LIDAR - MENU PRINCIPAL"); mainMenu.Add(mainTitle); var manageScans = new UIMenu("Gérer les scans"); mainMenu.Add(manageScans); { var manageScansTitle = new UITitle("LIDAR - GÉRER SCANS"); manageScans.Add(manageScansTitle); var addScan = new UIMenu("Ajouter un scan"); manageScans.Add(addScan); { var addScanTitle = new UITitle("LIDAR - AJOUTER UN SCAN"); addScan.Add(addScanTitle); var addExposition = new UIMenu("Ajouter une exposition"); addScan.Add(addExposition); { var addExpTitle = new UITitle("LIDAR - AJOUTER EXPOSITION"); addExposition.Add(addExpTitle); var addExpTime = new UIValueChangerInt("Temps", 1); addExposition.Add(addExpTime); } var addStream = new UIMenu("Ajouter une raffale"); addScan.Add(addStream); { var addStrmTitle = new UITitle("LIDAR - AJOUTER RAFFALE"); addStream.Add(addStrmTitle); } } var modifyScan = new UIMenu("Modifier un scan"); manageScans.Add(modifyScan); { var modifScanTitle = new UITitle("LIDAR - MODIFIER SCAN"); modifyScan.Add(modifScanTitle); } } var detected = new UIMenu("Détectés"); mainMenu.Add(detected); { var detectedTitle = new UITitle("LIDAR - OBJETS DÉTECTÉS"); detected.Add(detectedTitle); } var autre = new UIMenu("AutreMenu"); mainMenu.Add(autre); { var autreTitle = new UITitle("AUTRE TITRE"); autre.Add(autreTitle); } var text = new UINotSelectable("Hello"); mainMenu.Add(text); } Component.Current = (UISelectable)mainMenu.Items[1]; while (true) { //Console.WriteLine(Component.Current.Name); Component.Current.Show(); ConsoleKeyInfo key = Console.ReadKey(); switch (key.Key) { case ConsoleKey.UpArrow: Component.Current.Up(); break; case ConsoleKey.DownArrow: Component.Current.Down(); break; case ConsoleKey.LeftArrow: Component.Current.Back(); break; case ConsoleKey.RightArrow: Component.Current.Select(); break; case ConsoleKey.Enter: return; default: break; } Console.Clear(); } }