private void debugWindow(int windowID) { GUIStyle toggleStyle = new GUIStyle(GUI.skin.toggle); toggleStyle.stretchHeight = true; toggleStyle.stretchWidth = true; toggleStyle.padding = new RectOffset(4, 4, 4, 4); toggleStyle.margin = new RectOffset(4, 4, 4, 4); GUIStyle boxStyle = new GUIStyle(GUI.skin.box); boxStyle.stretchHeight = true; boxStyle.stretchWidth = true; boxStyle.padding = new RectOffset(4, 4, 4, 4); boxStyle.margin = new RectOffset(4, 4, 4, 4); activeTab = (MenuTab)GUILayout.SelectionGrid((int)activeTab, MenuTabStrings, 4); if (activeTab == MenuTab.DebugAndData) { DebugAndDataTab(); } GUI.DragWindow(); uiRectWindowDebug = UIUtility.ClampToScreen(uiRectWindowDebug); }
public override void receiveGamePadButton(Buttons key) { if (key == Buttons.LeftShoulder || key == Buttons.RightShoulder) { // rotate tab index int index = this.Tabs.FindIndex(p => p.name == this.CurrentTab.ToString()); if (key == Buttons.LeftShoulder) { index--; } if (key == Buttons.RightShoulder) { index++; } if (index >= this.Tabs.Count) { index = 0; } if (index < 0) { index = this.Tabs.Count - 1; } // open menu with new index MenuTab tabID = this.GetTabID(this.Tabs[index]); Game1.activeClickableMenu = new CheatsMenu(tabID, this.Config, this.Cheats, this.TranslationHelper); } }
/// <summary>Handle the player pressing a controller button.</summary> /// <param name="key">The key that was pressed.</param> public override void receiveGamePadButton(Buttons key) { // navigate tabs if ((key == Buttons.LeftShoulder || key == Buttons.RightShoulder) && !this.IsPressNewKeyActive()) { // rotate tab index int index = this.Tabs.FindIndex(p => p.name == this.CurrentTab.ToString()); if (key == Buttons.LeftShoulder) { index--; } if (key == Buttons.RightShoulder) { index++; } if (index >= this.Tabs.Count) { index = 0; } if (index < 0) { index = this.Tabs.Count - 1; } // open menu with new index MenuTab tabID = this.GetTabID(this.Tabs[index]); Game1.activeClickableMenu = new CheatsMenu(tabID, this.Cheats, this.Monitor); } // send to active menu (this.GetActiveOption() as BaseOptionsElement)?.ReceiveButtonPress(key.ToSButton()); }
private void tabControl1_Selected(object sender, TabControlEventArgs e) { if (tabControl1.SelectedTab != null) { _selectedMenuTab = (MenuTab)tabControl1.SelectedTab.Tag; } }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="currentTab">The selected tab.</param> /// <param name="sortBy">How to sort items.</param> /// <param name="quality">The item quality to display.</param> /// <param name="search">The search term to prepopulate.</param> /// <param name="i18n">Provides translations for the mod.</param> /// <param name="itemRepository">Provides methods for searching and constructing items.</param> public ItemMenu(MenuTab currentTab, ItemSort sortBy, ItemQuality quality, string search, ITranslationHelper i18n, ItemRepository itemRepository) : base(null, true, true, 0, -50) { // initialise this.TranslationHelper = i18n; this.ItemRepository = itemRepository; this.MovePosition(110, Game1.viewport.Height / 2 - (650 + IClickableMenu.borderWidth * 2) / 2); this.CurrentTab = currentTab; this.SortBy = sortBy; this.Quality = quality; this.SpawnableItems = this.ItemRepository.GetFiltered().Select(p => p.Item).ToArray(); this.AllowRightClick = true; // create search box int textWidth = Game1.tileSize * 8; this.Textbox = new TextBox(null, null, Game1.dialogueFont, Game1.textColor) { X = this.xPositionOnScreen + (this.width / 2) - (textWidth / 2) - Game1.tileSize + 32, Y = this.yPositionOnScreen + (this.height / 2) + Game1.tileSize * 2 + 40, Width = textWidth, Height = Game1.tileSize * 3, Selected = false, Text = search }; Game1.keyboardDispatcher.Subscriber = this.Textbox; this.TextboxBounds = new Rectangle(this.Textbox.X, this.Textbox.Y, this.Textbox.Width, this.Textbox.Height / 3); // create buttons this.Title = new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize, this.yPositionOnScreen - Game1.tileSize * 2, Game1.tileSize * 4, Game1.tileSize), i18n.Get("title")); this.QualityButton = new ClickableComponent(new Rectangle(this.xPositionOnScreen, this.yPositionOnScreen - Game1.tileSize * 2 + 10, (int)Game1.smallFont.MeasureString(i18n.Get("labels.quality")).X, Game1.tileSize), i18n.Get("labels.quality")); this.SortButton = new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.QualityButton.bounds.Width + 40, this.yPositionOnScreen - Game1.tileSize * 2 + 10, Game1.tileSize * 4, Game1.tileSize), this.GetSortLabel(sortBy)); this.UpArrow = new ClickableTextureComponent("up-arrow", new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize / 2, this.yPositionOnScreen - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 459, 11, 12), Game1.pixelZoom); this.DownArrow = new ClickableTextureComponent("down-arrow", new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize / 2, this.yPositionOnScreen + this.height / 2 - Game1.tileSize * 2, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 472, 11, 12), Game1.pixelZoom); // create tabs { int i = -1; int x = (int)(this.xPositionOnScreen - Game1.tileSize * 5.3f); int y = this.yPositionOnScreen + 10; int lblHeight = (int)(Game1.tileSize * 0.9F); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.All.ToString(), i18n.Get("tabs.all"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.ToolsAndEquipment.ToString(), i18n.Get("tabs.equipment"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.SeedsAndCrops.ToString(), i18n.Get("tabs.crops"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.FishAndBaitAndTrash.ToString(), i18n.Get("tabs.fishing"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.ForageAndFruits.ToString(), i18n.Get("tabs.forage"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.ArtifactsAndMinerals.ToString(), i18n.Get("tabs.artifacts-and-minerals"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.ResourcesAndCrafting.ToString(), i18n.Get("tabs.resources-and-crafting"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.ArtisanAndCooking.ToString(), i18n.Get("tabs.artisan-and-cooking"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.AnimalAndMonster.ToString(), i18n.Get("tabs.animal-and-monster"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Decorating.ToString(), i18n.Get("tabs.decorating"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i, Game1.tileSize * 5, Game1.tileSize), MenuTab.Misc.ToString(), i18n.Get("tabs.miscellaneous"))); } // load items this.LoadInventory(this.SpawnableItems); }
static void Main(string[] args) { MenuTab mtAdmin = new MenuTab("Administration"); List <SubMenuItem> UserAdministrationSub = new List <SubMenuItem>() { new SubMenuItem("Create", null), new SubMenuItem("Edit", null), }; mtAdmin.SubMenuItems.Children.Add(new SubMenuItem("USERADMIN", UserAdministrationSub)); //////////////////////PRODUCTS//////////////////////////// List <SubMenuItem> allProducts = new List <SubMenuItem>() { new SubMenuItem("AllProducts", null), }; List <SubMenuItem> productsTab = new List <SubMenuItem>() { new SubMenuItem("All Products", allProducts), new SubMenuItem("Create Product", null) }; mtAdmin.SubMenuItems.Children.Add(new SubMenuItem("PRODUCTS", productsTab)); ///////////////////// REPORTS///////////////////////////// List <SubMenuItem> orderAdmin = new List <SubMenuItem>() { new SubMenuItem("UpdatedOrder", null), new SubMenuItem("CreatedOrder", null) }; List <SubMenuItem> auditReports = new List <SubMenuItem>() { new SubMenuItem("Audit Reports", orderAdmin), }; List <SubMenuItem> OrderReports = new List <SubMenuItem>() { new SubMenuItem("AuditReports", auditReports), new SubMenuItem("Create Order", null), }; mtAdmin.SubMenuItems.Children.Add(new SubMenuItem("ORDER ADMIN", OrderReports)); ///REPORTS MenuTab mtReports = new MenuTab("Reports"); List <SubMenuItem> reports = new List <SubMenuItem>() { new SubMenuItem("Win Tech Report", null), new SubMenuItem("Microsoft", null), }; mtReports.SubMenuItems.Children.Add(new SubMenuItem("REPORTS", reports)); }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="initialTab">The tab to display by default.</param> /// <param name="cheats">The cheats helper.</param> /// <param name="monitor">Encapsulates monitoring and logging.</param> public CheatsMenu(MenuTab initialTab, CheatManager cheats, IMonitor monitor) { this.Cheats = cheats; this.Monitor = monitor; this.CurrentTab = initialTab; this.ResetComponents(); this.SetOptions(); }
/// <summary>Draw the menu to the screen.</summary> /// <param name="spriteBatch">The sprite batch being drawn.</param> public override void draw(SpriteBatch spriteBatch) { if (!Game1.options.showMenuBackground) { spriteBatch.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f); } base.draw(spriteBatch); Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height, false, true); CommonHelper.DrawTab(this.Title.bounds.X, this.Title.bounds.Y, Game1.dialogueFont, this.Title.name, 1); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null); for (int index = 0; index < this.OptionSlots.Count; ++index) { if (this.CurrentItemIndex >= 0 && this.CurrentItemIndex + index < this.Options.Count) { this.Options[this.CurrentItemIndex + index].draw(spriteBatch, this.OptionSlots[index].bounds.X, this.OptionSlots[index].bounds.Y + 5); } } spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); if (!GameMenu.forcePreventClose) { foreach (ClickableComponent tab in this.Tabs) { MenuTab tabID = this.GetTabID(tab); CommonHelper.DrawTab(tab.bounds.X + tab.bounds.Width, tab.bounds.Y, Game1.smallFont, tab.label, 2, this.CurrentTab == tabID ? 1F : 0.7F); } this.UpArrow.draw(spriteBatch); this.DownArrow.draw(spriteBatch); if (this.Options.Count > CheatsMenu.ItemsPerPage) { IClickableMenu.drawTextureBox(spriteBatch, Game1.mouseCursors, new Rectangle(403, 383, 6, 6), this.ScrollbarRunner.X, this.ScrollbarRunner.Y, this.ScrollbarRunner.Width, this.ScrollbarRunner.Height, Color.White, Game1.pixelZoom, false); this.Scrollbar.draw(spriteBatch); } } if (this.HoverText != "") { IClickableMenu.drawHoverText(spriteBatch, this.HoverText, Game1.smallFont); } if (!Game1.options.hardwareCursor && !this.IsAndroid) { spriteBatch.Draw(Game1.mouseCursors, new Vector2(Game1.getOldMouseX(), Game1.getOldMouseY()), Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, Game1.options.gamepadControls ? 44 : 0, 16, 16), Color.White, 0f, Vector2.Zero, Game1.pixelZoom + Game1.dialogueButtonScale / 150f, SpriteEffects.None, 1f); } // reinitialize the UI to fix Android pinch-zoom scaling issues if (this.JustOpened) { this.JustOpened = false; if (this.IsAndroid) { this.ResetComponents(); } } }
// Use this for initialization void Start() { currentMenu = MenuTab.Character; canvasGroup = GetComponent <CanvasGroup>(); TabsGroup.alpha = 0; TabsGroup.interactable = false; hideGroups(); }
public virtual MenuTab GetMenu() { if (_menuTab == null) { _menuTab = new MenuTab(); AggiungiComandi(); } return(_menuTab); }
/// <summary> /// Creates a new tab button. /// </summary> /// <param name="sprite">The sprite of the tab button</param> /// <param name="pageName">The name of the tab menu's page</param> /// <param name="gameObjectName">The name of the tab button's GameObject</param> /// <param name="tooltipText">The tooltip of the tab button</param> /// <param name="headerText">The text of the sub menu's header</param> /// <param name="creationCallback">An action that is called with the tabbutton object when the tabbutton is created</param> public TabButton(Sprite sprite, string pageName, string gameObjectName, string headerText, string tooltipText = "", Action <TabButton> creationCallback = null) : base(UiManager.QMStateController.transform.Find("Container/Window/Page_Buttons_QM/HorizontalLayoutGroup"), UiManager.QMStateController.transform.Find("Container/Window/Page_Buttons_QM/HorizontalLayoutGroup/Page_Dashboard").gameObject, sprite, gameObjectName, tooltipText) { MenuTab = gameObject.GetComponent <MenuTab>(); MenuTab.field_Private_MenuStateController_0 = UiManager.QMStateController; MenuTab.field_Public_String_0 = pageName; SubMenu = new TabMenu(pageName, $"Menu_{pageName}", headerText); creationCallback?.Invoke(this); }
void OnGUI() { if (!G.BeingSpied && MenuOpen) { GUI.skin = AssetUtilities.Skin; if (_cursorTexture == null) { _cursorTexture = Resources.Load("UI/Cursor") as Texture; } GUI.depth = -1; GUIStyle guiStyle = new GUIStyle("label"); guiStyle.margin = new RectOffset(10, 10, 5, 5); guiStyle.fontSize = 22; if (i < 0) { i++; } windowRect = GUILayout.Window(0, windowRect, MenuWindow, Enum.GetName(typeof(MenuTab), SelectedTab)); if (WhitelistWindow.WhitelistMenuOpen) { itemRect = GUILayout.Window(4, itemRect, WhitelistWindow.Window, (Cheats.Items.editingaip ? "Pickup " : "ESP ") + "Whitelist"); } if (GUIWindow.GUISkinMenuOpen) { guiRect = GUILayout.Window(5, guiRect, GUIWindow.Window, "GUI Skins"); } GUILayout.BeginArea(new Rect(0, i, Screen.width, 40), style: "NavBox"); GUILayout.BeginHorizontal(); GUI.color = new Color32(34, 177, 76, 255); GUILayout.Label($"<b>{Name}</b> <size=15>{Version}</size>", guiStyle); GUI.color = GUIColor; SelectedTab = (MenuTab)GUILayout.Toolbar((int)SelectedTab, buttons.ToArray(), style: "TabBtn"); GUILayout.EndHorizontal(); GUILayout.EndArea(); GUI.depth = -2; CursorPos.x = Input.mousePosition.x; CursorPos.y = Screen.height - Input.mousePosition.y; GUI.DrawTexture(CursorPos, _cursorTexture); Cursor.lockState = CursorLockMode.None; if (PlayerUI.window != null) { PlayerUI.window.showCursor = true; } GUI.skin = null; } }
private void ChangeTab(MenuTab menuTab) { LevelSelectTab.SetActive(menuTab == Scripts.MenuTab.LevelSelect); MenuTab.SetActive(menuTab == Scripts.MenuTab.MainMenu); ProgressTab.SetActive(menuTab == Scripts.MenuTab.Progress); SettingsTab.SetActive(menuTab == Scripts.MenuTab.Settings); PowerupsTab.SetActive(menuTab == Scripts.MenuTab.Powerups); HomeButton.SetActive(menuTab != Scripts.MenuTab.MainMenu); LastTab = menuTab; }
//Constructor public Menu(double screenWidthMultiplier, double screenHeightMultiplier, List <Orb> ownedOrbs) { inSubMenu = false; currentTab = MenuTab.status; this.ownedOrbs = ownedOrbs; largeSelectorWidth = (int)(525 * screenWidthMultiplier); largeSelectorHeight = (int)(200 * screenHeightMultiplier); smallSelectorWidth = (int)(150 * screenWidthMultiplier); smallSelectorHeight = (int)(150 * screenHeightMultiplier); selectorPosition = new Vector2(125, 132); }
/// <summary>Handle the player clicking the left mouse button.</summary> /// <param name="x">The cursor's X pixel position.</param> /// <param name="y">The cursor's Y pixel position.</param> /// <param name="playSound">Whether to play a sound if needed.</param> public override void receiveLeftClick(int x, int y, bool playSound = true) { if (GameMenu.forcePreventClose) { return; } base.receiveLeftClick(x, y, playSound); if (this.DownArrow.containsPoint(x, y) && this.CurrentItemIndex < Math.Max(0, this.Options.Count - CheatsMenu.ItemsPerPage)) { this.DownArrowPressed(); Game1.soundBank.PlayCue("shwip"); } else if (this.UpArrow.containsPoint(x, y) && this.CurrentItemIndex > 0) { this.UpArrowPressed(); Game1.soundBank.PlayCue("shwip"); } else if (this.Scrollbar.containsPoint(x, y)) { this.IsScrolling = true; } else if (!this.DownArrow.containsPoint(x, y) && x > this.xPositionOnScreen + this.width && (x < this.xPositionOnScreen + this.width + Game1.tileSize * 2 && y > this.yPositionOnScreen) && y < this.yPositionOnScreen + this.height) { this.IsScrolling = true; this.leftClickHeld(x, y); this.releaseLeftClick(x, y); } this.CurrentItemIndex = Math.Max(0, Math.Min(this.Options.Count - CheatsMenu.ItemsPerPage, this.CurrentItemIndex)); for (int index = 0; index < this.OptionSlots.Count; ++index) { if (this.OptionSlots[index].bounds.Contains(x, y) && this.CurrentItemIndex + index < this.Options.Count && this.Options[this.CurrentItemIndex + index].bounds.Contains(x - this.OptionSlots[index].bounds.X, y - this.OptionSlots[index].bounds.Y - 5)) { this.Options[this.CurrentItemIndex + index].receiveLeftClick(x - this.OptionSlots[index].bounds.X, y - this.OptionSlots[index].bounds.Y + 5); this.OptionsSlotHeld = index; break; } } foreach (var tab in this.Tabs) { if (tab.bounds.Contains(x, y)) { MenuTab tabID = this.GetTabID(tab); Game1.activeClickableMenu = new CheatsMenu(tabID, this.Cheats, this.Monitor); break; } } }
private void debugWindow(int windowID) { GUIStyle thisStyle = new GUIStyle(GUI.skin.toggle); thisStyle.stretchHeight = true; thisStyle.stretchWidth = true; thisStyle.padding = new RectOffset(4, 4, 4, 4); thisStyle.margin = new RectOffset(4, 4, 4, 4); GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.stretchHeight = true; buttonStyle.stretchWidth = true; buttonStyle.padding = new RectOffset(4, 4, 4, 4); buttonStyle.margin = new RectOffset(4, 4, 4, 4); GUIStyle boxStyle = new GUIStyle(GUI.skin.box); boxStyle.stretchHeight = true; boxStyle.stretchWidth = true; boxStyle.padding = new RectOffset(4, 4, 4, 4); boxStyle.margin = new RectOffset(4, 4, 4, 4); activeTab = (MenuTab)GUILayout.SelectionGrid((int)activeTab, MenuTab_str, 4); if (activeTab == MenuTab.DebugAndData) { DebugAndDataTab(thisStyle); } else if (activeTab == MenuTab.PartClassification) { PartClassificationTab(buttonStyle, boxStyle); } else if (activeTab == MenuTab.AeroStress) { AeroStressTab(buttonStyle, boxStyle); } else { AeroDataTab(buttonStyle, boxStyle); } // SaveWindowPos.x = windowPos.x; // SaveWindowPos.y = windowPos.y; GUI.DragWindow(); debugWinPos = FARGUIUtils.ClampToScreen(debugWinPos); }
private TabPage MenuTabToTabPage(MenuTab menu) { switch (menu) { case MenuTab.Home: return(tbpgHome); case MenuTab.Debug: return(tbpgDebug); case MenuTab.Chess: return(tbpgChess); case MenuTab.Tools: return(tbpgTools); default: throw new NotImplementedException("MenuTab not implemented: " + menu); } }
protected void Page_Load(object sender, EventArgs e) { //J'ai utilisé cette méthode pour avoir la même résultat de question MenuTab Menu = new MenuTab(); Menu.Afficher(tbMenu, Session["login"]); cn = new Connexion(Server); if (!IsPostBack) { DataTable dt = cn.extraire("select id,libelle from Categorie"); drpCategorie.DataSource = dt; drpCategorie.DataTextField = "libelle"; drpCategorie.DataValueField = "id"; drpCategorie.DataBind(); drpCategorie.Items.Insert(0, new ListItem("Tout", "0")); } }
private void debugWindow(int windowID) { var thisStyle = new GUIStyle(GUI.skin.toggle) { stretchHeight = true, stretchWidth = true, padding = new RectOffset(4, 4, 4, 4), margin = new RectOffset(4, 4, 4, 4) }; var buttonStyle = new GUIStyle(GUI.skin.button) { stretchHeight = true, stretchWidth = true, padding = new RectOffset(4, 4, 4, 4), margin = new RectOffset(4, 4, 4, 4) }; var boxStyle = new GUIStyle(GUI.skin.box) { stretchHeight = true, stretchWidth = true, padding = new RectOffset(4, 4, 4, 4), margin = new RectOffset(4, 4, 4, 4) }; activeTab = (MenuTab)GUILayout.SelectionGrid((int)activeTab, MenuTab_str, 3); switch (activeTab) { case MenuTab.DebugAndData: DebugAndDataTab(thisStyle); break; case MenuTab.AeroStress: AeroStressTab(buttonStyle, boxStyle); break; default: AeroDataTab(buttonStyle, boxStyle); break; } GUI.DragWindow(); debugWinPos = GUIUtils.ClampToScreen(debugWinPos); }
public MenuTab GetMenu() { if (_menuTab == null) { _menuTab = new MenuTab(); AggiungiPrincipale(); AggiungiImpostazioni(); AggiungiGestione(); AggiungiTabLog(); AggiungiComandiImportExport(); } return(_menuTab); }
protected void Page_Load(object sender, EventArgs e) { if (Session["login"] == null) { Response.Redirect("Login.aspx"); } MenuTab Menu = new MenuTab(); Menu.Afficher(tbMenu, Session["login"]); cn = new Connexion(Server); DataTable dt = cn.extraire("select numeroChambre as Numero,Format(dateArrivee,'dd/MM/yyyy') as [Date d'arrivee]," + "Format(dateDepart,'dd/MM/yyyy') as [Date de depart],totale as Totale from Reservation" + " where loginClient=" + Session["login"] + " order by dateArrivee desc"); grvHistorique.DataSource = dt; grvHistorique.DataBind(); lblCaption.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { if (Session["login"] != null) { Response.Redirect("Home.aspx"); } if (!IsPostBack) { if (Request.Cookies["login"] != null && Request.Cookies["pwd"] != null) { txtLogin.Text = Request.Cookies["login"].Value; txtPwd.Text = Request.Cookies["pwd"].Value; //cookie works fine but the textbox can't get it //because it's on password mode } } MenuTab Menu = new MenuTab(); Menu.Afficher(tbMenu, Session["login"]); cn = new Connexion(Server); }
public void ShowTab(MenuTab tab) { gameObject.SetActive(true); if (_current == _tabs[tab]) { return; } if (_current != null) { _current.TabContents.SetActive(false); _current.Text.color = InactiveTabColor; } CurrentTab = tab; _current = _tabs[tab]; _current.TabContents.SetActive(true); _current.Text.color = ActiveTabColor; TabChanged?.Invoke(tab); }
private void BindMenuTabVisibility() { return; var prevSelTab = tabControl1.SelectedTab; tabControl1.SuspendLayout(); // TODO: Make this smarter so Tools is the last menu and hidden tabs get inserted before Tools //foreach (var menu in Enum.GetValues(typeof(MenuTab)).Cast<MenuTab>()) //{ //} foreach (var kvp in _menuTabsVisibility) { var tbpg = MenuTabToTabPage(kvp.Key); if (kvp.Value) { if (!tabControl1.TabPages.Contains(tbpg)) { tabControl1.TabPages.Add(tbpg); } } else { if (tabControl1.TabPages.Contains(tbpg)) { tabControl1.TabPages.Remove(tbpg); } } } tabControl1.ResumeLayout(); if (prevSelTab != null) { SelectedMenuTab = (MenuTab)prevSelTab.Tag; } }
private void debugWindow(int windowID) { GUIStyle thisStyle = new GUIStyle(GUI.skin.toggle); thisStyle.stretchHeight = true; thisStyle.stretchWidth = true; thisStyle.padding = new RectOffset(4, 4, 4, 4); thisStyle.margin = new RectOffset(4, 4, 4, 4); GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.stretchHeight = true; buttonStyle.stretchWidth = true; buttonStyle.padding = new RectOffset(4, 4, 4, 4); buttonStyle.margin = new RectOffset(4, 4, 4, 4); GUIStyle boxStyle = new GUIStyle(GUI.skin.box); boxStyle.stretchHeight = true; boxStyle.stretchWidth = true; boxStyle.padding = new RectOffset(4, 4, 4, 4); boxStyle.margin = new RectOffset(4, 4, 4, 4); activeTab = (MenuTab)GUILayout.SelectionGrid((int)activeTab, MenuTab_str, 3); if (activeTab == MenuTab.DebugAndData) DebugAndDataTab(thisStyle); else if (activeTab == MenuTab.AeroStress) AeroStressTab(buttonStyle, boxStyle); else AeroDataTab(buttonStyle, boxStyle); // SaveWindowPos.x = windowPos.x;3 // SaveWindowPos.y = windowPos.y; GUI.DragWindow(); debugWinPos = GUIUtils.ClampToScreen(debugWinPos); }
/********* ** Public methods *********/ public CheatsMenu(MenuTab tabIndex, ModConfig config, Cheats cheats, ITranslationHelper i18n) : base(Game1.viewport.Width / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2) { this.Config = config; this.Cheats = cheats; this.TranslationHelper = i18n; this.Title = new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width / 2, this.yPositionOnScreen, Game1.tileSize * 4, Game1.tileSize), i18n.Get("title")); this.CurrentTab = tabIndex; { int i = 0; int labelX = (int)(this.xPositionOnScreen - Game1.tileSize * 4.8f); int labelY = (int)(this.yPositionOnScreen + Game1.tileSize * 1.5f); int labelHeight = (int)(Game1.tileSize * 0.9F); this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.PlayerAndTools.ToString(), i18n.Get("tabs.player-and-tools"))); this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.FarmAndFishing.ToString(), i18n.Get("tabs.farm-and-fishing"))); this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Skills.ToString(), i18n.Get("tabs.skills"))); this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Weather.ToString(), i18n.Get("tabs.weather"))); this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Relationships.ToString(), i18n.Get("tabs.relationships"))); this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.WarpLocations.ToString(), i18n.Get("tabs.warp"))); this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Time.ToString(), i18n.Get("tabs.time"))); this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Quests.ToString(), i18n.Get("tabs.quests"))); this.Tabs.Add(new ClickableComponent(new Rectangle(labelX, labelY + labelHeight * i, Game1.tileSize * 5, Game1.tileSize), MenuTab.Controls.ToString(), i18n.Get("tabs.controls"))); } this.UpArrow = new ClickableTextureComponent("up-arrow", new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 459, 11, 12), Game1.pixelZoom); this.DownArrow = new ClickableTextureComponent("down-arrow", new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize / 4, this.yPositionOnScreen + this.height - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 472, 11, 12), Game1.pixelZoom); this.Scrollbar = new ClickableTextureComponent("scrollbar", new Rectangle(this.UpArrow.bounds.X + Game1.pixelZoom * 3, this.UpArrow.bounds.Y + this.UpArrow.bounds.Height + Game1.pixelZoom, 6 * Game1.pixelZoom, 10 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(435, 463, 6, 10), Game1.pixelZoom); this.ScrollbarRunner = new Rectangle(this.Scrollbar.bounds.X, this.UpArrow.bounds.Y + this.UpArrow.bounds.Height + Game1.pixelZoom, this.Scrollbar.bounds.Width, this.height - Game1.tileSize * 2 - this.UpArrow.bounds.Height - Game1.pixelZoom * 2); for (int i = 0; i < CheatsMenu.ItemsPerPage; i++) { this.OptionSlots.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize * 5 / 4 + Game1.pixelZoom + i * ((this.height - Game1.tileSize * 2) / CheatsMenu.ItemsPerPage), this.width - Game1.tileSize / 2, (this.height - Game1.tileSize * 2) / CheatsMenu.ItemsPerPage + Game1.pixelZoom), string.Concat(i))); } int slotWidth = this.OptionSlots[0].bounds.Width; switch (this.CurrentTab) { case MenuTab.PlayerAndTools: this.Options.Add(new OptionsElement($"{i18n.Get("player.title")}:")); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("player.infinite-stamina"), config.InfiniteStamina, value => config.InfiniteStamina = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("player.infinite-health"), config.InfiniteHealth, value => config.InfiniteHealth = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("player.increased-movement-speed"), config.IncreasedMovement, value => config.IncreasedMovement = value)); this.Options.Add(new CheatsOptionsSlider(i18n.Get("player.movement-speed"), this.Config.MoveSpeed, 10, value => this.Config.MoveSpeed = value, disabled: () => !this.Config.IncreasedMovement)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("player.one-hit-kill"), config.OneHitKill, value => config.OneHitKill = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("player.max-daily-luck"), config.MaxDailyLuck, value => config.MaxDailyLuck = value)); this.Options.Add(new OptionsElement($"{i18n.Get("tools.title")}:")); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("tools.infinite-water"), config.InfiniteWateringCan, value => config.InfiniteWateringCan = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("tools.one-hit-break"), config.OneHitBreak, value => config.OneHitBreak = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("tools.harvest-with-sickle"), config.HarvestSickle, value => config.HarvestSickle = value)); this.Options.Add(new OptionsElement($"{i18n.Get("money.title")}:")); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("money.add-amount", new { amount = 100 }), 2, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("money.add-amount", new { amount = 1000 }), 3, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("money.add-amount", new { amount = 10000 }), 4, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("money.add-amount", new { amount = 100000 }), 5, slotWidth, config, cheats, i18n)); this.Options.Add(new OptionsElement($"{i18n.Get("casino-coins.title")}:")); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("casino-coins.add-amount", new { amount = 100 }), 6, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("casino-coins.add-amount", new { amount = 1000 }), 7, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("casino-coins.add-amount", new { amount = 10000 }), 8, slotWidth, config, cheats, i18n)); break; case MenuTab.FarmAndFishing: this.Options.Add(new OptionsElement($"{i18n.Get("farm.title")}:")); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("farm.water-all-fields"), 9, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("farm.durable-fences"), config.DurableFences, value => config.DurableFences = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("farm.instant-build"), config.InstantBuild, value => config.InstantBuild = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("farm.always-auto-feed"), config.AutoFeed, value => config.AutoFeed = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("farm.infinite-hay"), config.InfiniteHay, value => config.InfiniteHay = value)); this.Options.Add(new OptionsElement($"{i18n.Get("fishing.title")}:")); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fishing.instant-catch"), config.InstantCatch, value => config.InstantCatch = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fishing.instant-bite"), config.InstantBite, value => config.InstantBite = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fishing.always-throw-max-distance"), config.ThrowBobberMax, value => config.ThrowBobberMax = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fishing.always-treasure"), config.AlwaysTreasure, value => config.AlwaysTreasure = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("fishing.durable-tackles"), config.DurableTackles, value => config.DurableTackles = value)); this.Options.Add(new OptionsElement($"{i18n.Get("fast-machines.title")}:")); { IList <CheatsOptionsCheckbox> machines = new[] { new CheatsOptionsCheckbox(i18n.Get("fast-machines.cask"), config.FastCask, value => config.FastCask = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.furnace"), config.FastFurnace, value => config.FastFurnace = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.recycling-machine"), config.FastRecyclingMachine, value => config.FastRecyclingMachine = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.crystalarium"), config.FastCrystalarium, value => config.FastCrystalarium = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.incubator"), config.FastIncubator, value => config.FastIncubator = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.slime-incubator"), config.FastSlimeIncubator, value => config.FastSlimeIncubator = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.keg"), config.FastKeg, value => config.FastKeg = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.preserves-jar"), config.FastPreservesJar, value => config.FastPreservesJar = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.cheese-press"), config.FastCheesePress, value => config.FastCheesePress = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.mayonnaise-machine"), config.FastMayonnaiseMachine, value => config.FastMayonnaiseMachine = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.loom"), config.FastLoom, value => config.FastLoom = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.oil-maker"), config.FastOilMaker, value => config.FastOilMaker = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.seed-maker"), config.FastSeedMaker, value => config.FastSeedMaker = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.charcoal-kiln"), config.FastCharcoalKiln, value => config.FastCharcoalKiln = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.slime-egg-press"), config.FastSlimeEggPress, value => config.FastSlimeEggPress = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.tapper"), config.FastTapper, value => config.FastTapper = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.lightning-rod"), config.FastLightningRod, value => config.FastLightningRod = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.bee-house"), config.FastBeeHouse, value => config.FastBeeHouse = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.mushroom-box"), config.FastMushroomBox, value => config.FastMushroomBox = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.worm-bin"), config.FastWormBin, value => config.FastWormBin = value), new CheatsOptionsCheckbox(i18n.Get("fast-machines.fruit-trees"), config.FastFruitTree, value => config.FastFruitTree = value) }; this.Options.AddRange(machines.OrderBy(p => p.label)); } break; case MenuTab.Skills: this.Options.Add(new OptionsElement($"{i18n.Get("skills.title")}:")); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.increase-farming"), 200, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.increase-mining"), 201, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.increase-foraging"), 202, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.increase-fishing"), 203, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.increase-combat"), 204, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("skills.reset"), 205, slotWidth, config, cheats, i18n)); this.Options.Add(new OptionsElement($"{i18n.Get("professions.title")}:")); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.fighter"), this.GetProfession(SFarmer.fighter), value => this.SetProfession(SFarmer.fighter, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.scout"), this.GetProfession(SFarmer.scout), value => this.SetProfession(SFarmer.scout, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.acrobat"), this.GetProfession(SFarmer.acrobat), value => this.SetProfession(SFarmer.acrobat, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.brute"), this.GetProfession(SFarmer.brute), value => this.SetProfession(SFarmer.brute, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.defender"), this.GetProfession(SFarmer.defender), value => this.SetProfession(SFarmer.defender, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.combat.desperado"), this.GetProfession(SFarmer.desperado), value => this.SetProfession(SFarmer.desperado, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.rancher"), this.GetProfession(SFarmer.rancher), value => this.SetProfession(SFarmer.rancher, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.tiller"), this.GetProfession(SFarmer.tiller), value => this.SetProfession(SFarmer.tiller, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.agriculturist"), this.GetProfession(SFarmer.agriculturist), value => this.SetProfession(SFarmer.agriculturist, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.artisan"), this.GetProfession(SFarmer.artisan), value => this.SetProfession(SFarmer.artisan, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.coopmaster"), this.GetProfession(SFarmer.butcher), value => this.SetProfession(SFarmer.butcher, value))); // butcher = coopmaster this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.farming.shepherd"), this.GetProfession(SFarmer.shepherd), value => this.SetProfession(SFarmer.shepherd, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.fisher"), this.GetProfession(SFarmer.fisher), value => this.SetProfession(SFarmer.fisher, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.trapper"), this.GetProfession(SFarmer.trapper), value => this.SetProfession(SFarmer.trapper, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.angler"), this.GetProfession(SFarmer.angler), value => this.SetProfession(SFarmer.angler, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.luremaster"), this.GetProfession(SFarmer.mariner), value => this.SetProfession(SFarmer.mariner, value))); // mariner = luremaster (???) this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.mariner"), this.GetProfession(SFarmer.baitmaster), value => this.SetProfession(SFarmer.baitmaster, value))); // baitmaster = mariner (???) this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.fishing.pirate"), this.GetProfession(SFarmer.pirate), value => this.SetProfession(SFarmer.pirate, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.forester"), this.GetProfession(SFarmer.forester), value => this.SetProfession(SFarmer.forester, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.gatherer"), this.GetProfession(SFarmer.gatherer), value => this.SetProfession(SFarmer.gatherer, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.botanist"), this.GetProfession(SFarmer.botanist), value => this.SetProfession(SFarmer.botanist, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.lumberjack"), this.GetProfession(SFarmer.lumberjack), value => this.SetProfession(SFarmer.lumberjack, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.tapper"), this.GetProfession(SFarmer.tapper), value => this.SetProfession(SFarmer.tapper, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.foraging.tracker"), this.GetProfession(SFarmer.tracker), value => this.SetProfession(SFarmer.tracker, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.geologist"), this.GetProfession(SFarmer.geologist), value => this.SetProfession(SFarmer.geologist, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.miner"), this.GetProfession(SFarmer.miner), value => this.SetProfession(SFarmer.miner, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.blacksmith"), this.GetProfession(SFarmer.blacksmith), value => this.SetProfession(SFarmer.blacksmith, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.excavator"), this.GetProfession(SFarmer.excavator), value => this.SetProfession(SFarmer.excavator, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.gemologist"), this.GetProfession(SFarmer.gemologist), value => this.SetProfession(SFarmer.gemologist, value))); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("professions.mining.prospector"), this.GetProfession(SFarmer.burrower), value => this.SetProfession(SFarmer.burrower, value))); // burrower = prospector break; case MenuTab.Weather: this.Options.Add(new OptionsElement($"{i18n.Get("weather.title")}:")); this.Options.Add(new CheatsOptionsWeatherElement($"{i18n.Get("weather.current")}", () => CJB.GetWeatherNexDay(i18n))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("weather.sunny"), 10, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("weather.raining"), 11, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("weather.lightning"), 12, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("weather.snowing"), 13, slotWidth, config, cheats, i18n)); break; case MenuTab.Relationships: { this.Options.Add(new OptionsElement($"{i18n.Get("relationships.title")}:")); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("relationships.give-gifts-anytime"), config.AlwaysGiveGift, value => config.AlwaysGiveGift = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("relationships.no-decay"), config.NoFriendshipDecay, value => config.NoFriendshipDecay = value)); this.Options.Add(new OptionsElement($"{i18n.Get("relationships.friends")}:")); foreach (NPC npc in this.GetSocialCharacters().Distinct().OrderBy(p => p.displayName)) { this.Options.Add(new CheatsOptionsNpcSlider(npc, onValueChanged: points => this.Cheats.UpdateFriendship(npc, points))); } } break; case MenuTab.WarpLocations: this.Options.Add(new OptionsElement($"{i18n.Get("warp.title")}:")); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.farm"), slotWidth, this.WarpToFarm)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.pierre-shop"), slotWidth, () => this.Warp("Town", 43, 57))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.blacksmith"), slotWidth, () => this.Warp("Town", 94, 82))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.museum"), slotWidth, () => this.Warp("Town", 101, 90))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.saloon"), slotWidth, () => this.Warp("Town", 45, 71))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.community-center"), slotWidth, () => this.Warp("Town", 52, 20))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.carpenter"), slotWidth, () => this.Warp("Mountain", 12, 26))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.adventurers-guild"), slotWidth, () => this.Warp("Mountain", 76, 9))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.ranch"), slotWidth, () => this.Warp("Forest", 90, 16))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.mines"), slotWidth, () => this.Warp("Mine", 13, 10))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.willy-shop"), slotWidth, () => this.Warp("Beach", 30, 34))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.wizard-tower"), slotWidth, () => this.Warp("Forest", 5, 27))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.hats"), slotWidth, () => this.Warp("Forest", 34, 96))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.desert"), slotWidth, () => this.Warp("Desert", 18, 28))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.sandy-shop"), slotWidth, () => this.Warp("SandyHouse", 4, 8))); if (Game1.player.hasClubCard) { this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.casino"), slotWidth, () => this.Warp("Club", 8, 11))); } this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.quarry"), slotWidth, () => this.Warp("Mountain", 127, 12))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.new-beach"), slotWidth, () => this.Warp("Beach", 87, 26))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.secret-woods"), slotWidth, () => this.Warp("Woods", 58, 15))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.sewer"), slotWidth, () => this.Warp("Sewer", 3, 48))); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("warp.bathhouse"), slotWidth, () => this.Warp("Railroad", 10, 57))); break; case MenuTab.Time: this.Options.Add(new OptionsElement($"{i18n.Get("time.title")}:")); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("time.freeze-inside"), config.FreezeTimeInside, value => config.FreezeTimeInside = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("time.freeze-caves"), config.FreezeTimeCaves, value => config.FreezeTimeCaves = value)); this.Options.Add(new CheatsOptionsCheckbox(i18n.Get("time.freeze-everywhere"), config.FreezeTime, value => config.FreezeTime = value)); this.Options.Add(new CheatsOptionsSlider(i18n.Get("time.time"), (Game1.timeOfDay - 600) / 100, 19, value => this.SafelySetTime((value * 100) + 600), width: 100, format: value => Game1.getTimeOfDayString((value * 100) + 600))); break; case MenuTab.Quests: { this.Options.Add(new OptionsElement($"{i18n.Get("activequests.title")}:")); { int i = 0; foreach (Quest quest in Game1.player.questLog) { if (!quest.completed.Value) { this.Options.Add(new CheatsOptionsInputListener(quest.questTitle, 300 + i++, slotWidth, config, cheats, i18n)); } } } this.Options.Add(new OptionsElement($"{i18n.Get("completedquests.title")}:")); foreach (Quest quest in Game1.player.questLog) { if (quest.completed.Value) { this.Options.Add(new OptionsElement(quest.questTitle) { whichOption = -999 }); } } } break; case MenuTab.Controls: this.Options.Add(new OptionsElement($"{i18n.Get("controls.title")}:")); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("controls.open-menu"), 1000, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("controls.freeze-time"), 1001, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("controls.grow-tree"), 1002, slotWidth, config, cheats, i18n)); this.Options.Add(new CheatsOptionsInputListener(i18n.Get("controls.grow-crops"), 1003, slotWidth, config, cheats, i18n)); break; } this.SetScrollBarToCurrentIndex(); }
internal JoeMenu(int width, int height) : base(Game1.viewport.Width / 2 - width / 2, Game1.viewport.Height / 2 - height / 2, width, height, true) { ITranslationHelper translation = InstanceHolder.Translation; _upCursor = new ClickableTextureComponent("up-arrow", new Rectangle(xPositionOnScreen + this.width + Game1.tileSize / 4, yPositionOnScreen + Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 459, 11, 12), Game1.pixelZoom); _downCursor = new ClickableTextureComponent("down-arrow", new Rectangle(xPositionOnScreen + this.width + Game1.tileSize / 4, yPositionOnScreen + this.height - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 472, 11, 12), Game1.pixelZoom); _scrollBar = new ClickableTextureComponent(new Rectangle(_upCursor.bounds.X + 12, _upCursor.bounds.Y + _upCursor.bounds.Height + 4, 24, 40), Game1.mouseCursors, new Rectangle(435, 463, 6, 10), 4f); _scrollBarRunner = new Rectangle(_scrollBar.bounds.X, _upCursor.bounds.Y + _upCursor.bounds.Height + 4, _scrollBar.bounds.Width, height - 128 - _upCursor.bounds.Height - 8); _tabAutomationString = translation.Get("tab.automation"); Vector2 size = _font.MeasureString(_tabAutomationString); _tabAutomation = new Rectangle(xPositionOnScreen - (int)size.X - 20, yPositionOnScreen, (int)size.X + 32, 64); _tabUIsString = translation.Get("tab.UIs"); size = _font.MeasureString(_tabUIsString); _tabUIs = new Rectangle(xPositionOnScreen - (int)size.X - 20, yPositionOnScreen + 68, (int)size.X + 32, 64); _tabMiscString = translation.Get("tab.misc"); size = _font.MeasureString(_tabMiscString); _tabMisc = new Rectangle(xPositionOnScreen - (int)size.X - 20, yPositionOnScreen + 68 * 2, (int)size.X + 32, 64); _tabControlsString = translation.Get("tab.controls"); size = _font.MeasureString(_tabControlsString); _tabControls = new Rectangle(xPositionOnScreen - (int)size.X - 20, yPositionOnScreen + 68 * 3, (int)size.X + 32, 64); { //Automation Tab MenuTab tab = new MenuTab(); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Balanced Mode")); tab.AddOptionsElement(new ModifiedCheckBox("BalancedMode", 20, Config.BalancedMode, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Water Nearby Crops")); tab.AddOptionsElement(new ModifiedCheckBox("AutoWaterNearbyCrops", 2, Config.AutoWaterNearbyCrops, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("AutoWaterRadius", 3, Config.AutoWaterRadius, 1, 3, OnSliderValueChanged, () => !Config.AutoWaterNearbyCrops || Config.BalancedMode)); tab.AddOptionsElement(new ModifiedCheckBox("FindCanFromInventory", 16, Config.FindCanFromInventory, OnCheckboxValueChanged, i => !(Config.AutoWaterNearbyCrops || Config.AutoRefillWateringCan))); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Pet Nearby Animals/Pets")); tab.AddOptionsElement(new ModifiedCheckBox("AutoPetNearbyAnimals", 3, Config.AutoPetNearbyAnimals, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedCheckBox("AutoPetNearbyPets", 24, Config.AutoPetNearbyPets, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("AutoPetRadius", 4, Config.AutoPetRadius, 1, 3, OnSliderValueChanged, () => !Config.AutoPetNearbyAnimals || Config.BalancedMode)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Animal Door")); tab.AddOptionsElement(new ModifiedCheckBox("AutoAnimalDoor", 4, Config.AutoAnimalDoor, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("AFK Fishing")); tab.AddOptionsElement(new ModifiedCheckBox("AutoFishing", 5, Config.AutoFishing, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("CPUThresholdFishing", 0, (int)(Config.CpuThresholdFishing * 10), 0, 5, OnSliderValueChanged, () => !Config.AutoFishing, Format)); tab.AddOptionsElement(new ModifiedCheckBox("AutoReelRod", 6, Config.AutoReelRod, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("ThrowPower", 17, (int)(Config.ThrowPower * 10), 0, 10, OnSliderValueChanged, null, Format)); tab.AddOptionsElement(new ModifiedSlider("ThresholdStaminaPersentage", 18, Config.ThresholdStaminaPercentage, 10, 60, OnSliderValueChanged, null, Format)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Gate")); tab.AddOptionsElement(new ModifiedCheckBox("AutoGate", 9, Config.AutoGate, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Eat")); tab.AddOptionsElement(new ModifiedCheckBox("AutoEat", 10, Config.AutoEat, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("StaminaToEatRatio", 1, (int)(Config.StaminaToEatRatio * 10), 1, 8, OnSliderValueChanged, () => !Config.AutoEat, Format)); tab.AddOptionsElement(new ModifiedSlider("HealthToEatRatio", 2, (int)(Config.HealthToEatRatio * 10), 1, 8, OnSliderValueChanged, () => !Config.AutoEat, Format)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Harvest")); tab.AddOptionsElement(new ModifiedCheckBox("AutoHarvest", 11, Config.AutoHarvest, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("AutoHarvestRadius", 5, Config.AutoHarvestRadius, 1, 3, OnSliderValueChanged, () => !Config.AutoHarvest || Config.BalancedMode)); tab.AddOptionsElement(new ModifiedCheckBox("ProtectNectarProducingFlower", 25, Config.ProtectNectarProducingFlower, OnCheckboxValueChanged, i => !Config.AutoHarvest)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Destroy Dead Crops")); tab.AddOptionsElement(new ModifiedCheckBox("AutoDestroyDeadCrops", 12, Config.AutoDestroyDeadCrops, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Refill Watering Can")); tab.AddOptionsElement(new ModifiedCheckBox("AutoRefillWateringCan", 13, Config.AutoRefillWateringCan, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Collect Collectibles")); tab.AddOptionsElement(new ModifiedCheckBox("AutoCollectCollectibles", 14, Config.AutoCollectCollectibles, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("AutoCollectRadius", 6, Config.AutoCollectRadius, 1, 3, OnSliderValueChanged, () => !Config.AutoCollectCollectibles || Config.BalancedMode)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Shake Fruited Plants")); tab.AddOptionsElement(new ModifiedCheckBox("AutoShakeFruitedPlants", 15, Config.AutoShakeFruitedPlants, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("AutoShakeRadius", 7, Config.AutoShakeRadius, 1, 3, OnSliderValueChanged, () => !Config.AutoShakeFruitedPlants || Config.BalancedMode)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Dig Artifact Spot")); tab.AddOptionsElement(new ModifiedCheckBox("AutoDigArtifactSpot", 17, Config.AutoDigArtifactSpot, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("AutoDigRadius", 8, Config.AutoDigRadius, 1, 3, OnSliderValueChanged, () => !Config.AutoDigArtifactSpot || Config.BalancedMode)); tab.AddOptionsElement(new ModifiedCheckBox("FindHoeFromInventory", 18, Config.FindHoeFromInventory, OnCheckboxValueChanged, i => !Config.AutoDigArtifactSpot)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Deposit/Pull Machines")); tab.AddOptionsElement(new ModifiedCheckBox("AutoDepositIngredient", 22, Config.AutoDepositIngredient, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedCheckBox("AutoPullMachineResult", 23, Config.AutoPullMachineResult, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("MachineRadius", 10, Config.MachineRadius, 1, 3, OnSliderValueChanged, () => !(Config.AutoPullMachineResult || Config.AutoDepositIngredient) || Config.BalancedMode)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Loot Treasures")); tab.AddOptionsElement(new ModifiedCheckBox("AutoLootTreasures", 30, Config.AutoLootTreasures, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedCheckBox("CloseTreasureWhenAllLooted", 31, Config.CloseTreasureWhenAllLooted, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Pick Up Trash")); tab.AddOptionsElement(new ModifiedCheckBox("AutoPickUpTrash", 34, Config.AutoPickUpTrash, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("ScavengingRadius", 13, Config.ScavengingRadius, 1, 3, OnSliderValueChanged, () => !Config.AutoPickUpTrash || Config.BalancedMode)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Shearing and Milking")); tab.AddOptionsElement(new ModifiedCheckBox("AutoShearingAndMilking", 35, Config.AutoShearingAndMilking, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("AnimalHarvestRadius", 14, Config.AnimalHarvestRadius, 1, 3, OnSliderValueChanged, () => !Config.AutoShearingAndMilking || Config.BalancedMode)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Collect Letter Attachments And Quests")); tab.AddOptionsElement(new ModifiedCheckBox("CollectLetterAttachmentsAndQuests", 36, Config.CollectLetterAttachmentsAndQuests, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Farm Cleaner")); tab.AddOptionsElement(new ModifiedSlider("RadiusFarmCleanup", 16, Config.RadiusFarmCleanup, 1, 3, OnSliderValueChanged, () => !(Config.CutWeeds || Config.ChopTwigs || Config.BreakRocks))); tab.AddOptionsElement(new ModifiedCheckBox("CutWeeds", 39, Config.CutWeeds, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedCheckBox("BreakRocks", 40, Config.BreakRocks, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedCheckBox("ChopTwigs", 41, Config.ChopTwigs, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); _tabs.Add(tab); } { //UIs Tab MenuTab tab = new MenuTab(); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Config Menu")); tab.AddOptionsElement(new ModifiedCheckBox("FilterBackgroundInMenu", 32, Config.FilterBackgroundInMenu, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedCheckBox("ShowMousePositionWhenAssigningLocation", 38, Config.ShowMousePositionWhenAssigningLocation, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Mine Info GUI")); tab.AddOptionsElement(new ModifiedCheckBox("MineInfoGUI", 0, Config.MineInfoGui, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Gift Information Tooltip")); tab.AddOptionsElement(new ModifiedCheckBox("GiftInformation", 1, Config.GiftInformation, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Fishing Info")); tab.AddOptionsElement(new ModifiedCheckBox("FishingInfo", 8, Config.FishingInfo, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Fishing Probabilities Information")); tab.AddOptionsElement(new ModifiedCheckBox("FishingProbabilitiesInfo", 26, Config.FishingProbabilitiesInfo, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedClickListener(this, "ProbBoxLocation", 0, Config.ProbBoxCoordinates.X, Config.ProbBoxCoordinates.Y, translation, OnSomewhereClicked, OnStartListeningClick)); tab.AddOptionsElement(new ModifiedCheckBox("MorePreciseProbabilities", 37, Config.MorePreciseProbabilities, OnCheckboxValueChanged, i => !Config.FishingProbabilitiesInfo)); tab.AddOptionsElement(new ModifiedSlider("TrialOfExamine", 15, Config.TrialOfExamine, 1, 50, OnSliderValueChanged, () => !(Config.FishingProbabilitiesInfo && Config.MorePreciseProbabilities))); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Show Shipping Price")); tab.AddOptionsElement(new ModifiedCheckBox("EstimateShippingPrice", 28, Config.EstimateShippingPrice, OnCheckboxValueChanged)); tab.AddOptionsElement( new ModifiedClickListener(this, "PriceBoxCoordinates", 1, Config.PriceBoxCoordinates.X, Config.PriceBoxCoordinates.Y, translation, OnSomewhereClicked, OnStartListeningClick)); tab.AddOptionsElement(new EmptyLabel()); _tabs.Add(tab); } { //Misc Tab MenuTab tab = new MenuTab(); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Unify Flower Colors")); tab.AddOptionsElement(new ModifiedCheckBox("UnifyFlowerColors", 29, Config.UnifyFlowerColors, OnCheckboxValueChanged)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Pause When Idle")); tab.AddOptionsElement(new ModifiedCheckBox("PauseWhenIdle", 33, Config.PauseWhenIdle, OnCheckboxValueChanged)); tab.AddOptionsElement(new ModifiedSlider("IdleTimeout", 12, Config.IdleTimeout, 1, 300, OnSliderValueChanged, () => !Config.PauseWhenIdle, (which, value) => value + "s")); tab.AddOptionsElement(new EmptyLabel()); _tabs.Add(tab); } { //Controls Tab MenuTab tab = new MenuTab(); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Config Menu")); tab.AddOptionsElement(new ModifiedInputListener(this, "KeyShowMenu", 0, Config.ButtonShowMenu, translation, OnInputListenerChanged, OnStartListening)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Auto Harvest")); tab.AddOptionsElement(new ModifiedInputListener(this, "KeyToggleBlackList", 1, Config.ButtonToggleBlackList, translation, OnInputListenerChanged, OnStartListening)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("Unify Flower Colors")); tab.AddOptionsElement(new ModifiedInputListener(this, "ButtonToggleFlowerColorUnification", 2, Config.ButtonToggleFlowerColorUnification, translation, OnInputListenerChanged, OnStartListening)); tab.AddOptionsElement(new EmptyLabel()); tab.AddOptionsElement(new LabelComponent("AFK Fishing")); tab.AddOptionsElement(new ModifiedInputListener(this, "ToggleAFKFishing", 3, Config.ToggleAfkFishing, translation, OnInputListenerChanged, OnStartListening)); tab.AddOptionsElement(new EmptyLabel()); _tabs.Add(tab); } }
private void debugWindow(int windowID) { GUIStyle toggleStyle = new GUIStyle (GUI.skin.toggle); toggleStyle.stretchHeight = true; toggleStyle.stretchWidth = true; toggleStyle.padding = new RectOffset (4, 4, 4, 4); toggleStyle.margin = new RectOffset (4, 4, 4, 4); GUIStyle boxStyle = new GUIStyle (GUI.skin.box); boxStyle.stretchHeight = true; boxStyle.stretchWidth = true; boxStyle.padding = new RectOffset (4, 4, 4, 4); boxStyle.margin = new RectOffset (4, 4, 4, 4); activeTab = (MenuTab) GUILayout.SelectionGrid ((int) activeTab, MenuTabStrings, 4); if (activeTab == MenuTab.DebugAndData) DebugAndDataTab (); GUI.DragWindow (); uiRectWindowDebug = UIUtility.ClampToScreen (uiRectWindowDebug); }
public static void ResetLastTab() { LastTab = Scripts.MenuTab.MainMenu; }
void OnGUI() { useGUILayout = false; if (showMenu) { bool fadingOut = screenFadeObj != null && screenFadeObj.GetComponent<ScreenFading>().IsTransitioning(); //Freeze the game if the menu is active Time.timeScale = EPSILON; //Main menu frame GUI.Box (new Rect (Screen.width / 2 - menuWidth / 2, Screen.height / 2 - menuHeight / 2, menuWidth, menuHeight), "", panelStyle); //Buttons for the three tabs if (GUI.Button (new Rect (Screen.width / 2 - menuWidth / 2 + 10, Screen.height / 2 - menuHeight / 2 + 10, tabButtonWidth, tabButtonHeight), "Saves", button150x50Style)) { if (currentTab != MenuTab.Save && switchPanelSrc != null) switchPanelSrc.Play (); currentTab = MenuTab.Save; } if (GUI.Button (new Rect (Screen.width / 2 - tabButtonWidth / 2, Screen.height / 2 - menuHeight / 2 + 10, tabButtonWidth, tabButtonHeight), "Collection", button150x50Style)) { if (currentTab != MenuTab.Inventory && switchPanelSrc != null) switchPanelSrc.Play (); currentTab = MenuTab.Inventory; } if (GUI.Button (new Rect (Screen.width / 2 + menuWidth / 2 - 10 - tabButtonWidth, Screen.height / 2 - menuHeight / 2 + 10, tabButtonWidth, tabButtonHeight), "Map", button150x50Style)) { if (currentTab != MenuTab.Map && switchPanelSrc != null) switchPanelSrc.Play (); currentTab = MenuTab.Map; } //The following layout of the menu is dependent on which tab is open //Save tab layout - scrollable list of save files //from which you can save, load, or create a new save if (currentTab == MenuTab.Save) { GUI.skin = scrollbarSkin; scrollPosition = GUI.BeginScrollView (new Rect (Screen.width / 2 - menuWidth / 2 + 10, Screen.height / 2 - menuHeight / 2 + 15 + tabButtonHeight, scrollViewWidth, scrollViewHeight), scrollPosition, new Rect (0, 0, scrollViewWidth - 20, saveFileList.Count*50+10)); GUI.skin = null; if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer) { if (GUI.Button(new Rect(0, 10, 240, tabButtonHeight), "Download Save File", button240x50Style) && !fadingOut) { PlayerDataManager.DownloadCurrent(); } else if (GUI.Button (new Rect(0, 70, 240, tabButtonHeight), "Upload Save File", button240x50Style) && !fadingOut) { Application.ExternalCall("RequestUpload", ""); } } else { // A button for creating a new save file if(GUI.Button (new Rect(0,10,240,tabButtonHeight),"Save to New File", button240x50Style) && !fadingOut) { if (saveSrc != null) saveSrc.Play(); BounceXmlSerializer.currentSaveFile = saveFileList.Count; PlayerDataManager.SaveCurrent(); saveFileList = BounceXmlSerializer.RetrieveMetaData(); GameObject noteObj = GameObject.FindGameObjectWithTag("NoteManager"); noteObj.GetComponent<NotificationManager>().PushMessage("Saved game."); } if (BounceXmlSerializer.currentSaveFile >= 0 && saveFileList.Count > 0) { // A button for creating a new save file if(GUI.Button (new Rect(240,10,240,tabButtonHeight),"Overwrite current data (" + BounceXmlSerializer.currentSaveFile + ")", button240x50Style) && !fadingOut) { if (saveSrc != null) saveSrc.Play(); PlayerDataManager.SaveCurrent(); saveFileList = BounceXmlSerializer.RetrieveMetaData(); GameObject noteObj = GameObject.FindGameObjectWithTag("NoteManager"); noteObj.GetComponent<NotificationManager>().PushMessage("Saved game."); } } // A list of all our save files for(int i = 1; i < saveFileList.Count+1; i++) { //string s = saveFileList[i-1]; int saveFileIndex = i-1; //GUI.Label (new Rect (10, i*60+10, scrollViewWidth-10, 50),"File "+saveFileIndex, labelStyle); BounceFileMetaData metadata = saveFileList[saveFileIndex]; long minutes = (metadata.numberSeconds/60)%60; long hours = metadata.numberSeconds/3600; GUI.Label (new Rect (10, i*60+10, 110, 20), ImmutableData.GetCheckpointData()[metadata.lastCheckpoint].name, labelStyle); GUI.Label (new Rect (10, i*60+30, 110, 20), string.Format("Playtime: {0:D2}:{1:D2}", hours, minutes), labelStyle); GUI.Label (new Rect (120, i*60+10, 110, 20), string.Format("Collectibles: {0}", metadata.numberCollectibles), labelStyle); GUI.Label (new Rect (120, i*60+30, 110, 20), string.Format("Deaths: {0}", metadata.numberDeaths), labelStyle); if(GUI.Button (new Rect(240,i*60+10,120,50),"Overwrite", button120x50Style) && !fadingOut) { if (saveSrc != null) saveSrc.Play(); BounceXmlSerializer.currentSaveFile = metadata.index; PlayerDataManager.SaveCurrent(); saveFileList = BounceXmlSerializer.RetrieveMetaData(); GameObject noteObj = GameObject.FindGameObjectWithTag("NoteManager"); noteObj.GetComponent<NotificationManager>().PushMessage("Saved game."); } if(GUI.Button (new Rect(360,i*60+10,120,50),"Load", button120x50Style) && !fadingOut) { if (loadSrc != null) loadSrc.Play(); loadDataIndex = metadata.index; if (screenFadeObj != null) { screenFadeObj.GetComponent<ScreenFading>().fadeSpeed /= EPSILON; screenFadeObj.GetComponent<ScreenFading>().Transition(LoadTransition, true); } else LoadTransition(); } } } GUI.EndScrollView (); } //Inventory tab layout - grid of items //hovering over an item yields its name and description if (currentTab == MenuTab.Inventory) { //GUI.skin = scrollbarSkin; //scrollPositionI = GUI.BeginScrollView (new Rect (Screen.width / 2 - menuWidth / 2 + 10, Screen.height / 2 - menuHeight / 2 + 15 + tabButtonHeight, scrollViewWidth, scrollViewHeight), // scrollPositionI, new Rect (0, 0, scrollViewWidth - 20, scrollViewHeight * 4)); //GUI.skin = null; GUI.BeginGroup(new Rect(Screen.width/2 - menuWidth/2 + 10, Screen.height/2-menuHeight/2 + 15 + tabButtonHeight, scrollViewWidth, scrollViewHeight)); Dictionary<ItemType, ImmutableData.ItemData>.Enumerator iter = ImmutableData.GetItemData().GetEnumerator(); if (iter.MoveNext()) { bool iterdone = false; //Todo: adjust bounds based on number of items & adjust sizes of buttons dynamically based on menu panel size for (int i = 0; i < 5; i++) { for (int j = 0; j < 7; j++) { Rect buttonBoundingBox = new Rect(10 + (j * 60), 120 + (i * 60), 50, 50); if (PlayerDataManager.inventory.HasItem(iter.Current.Key)) { string nameStr = ""; string infoStr = ""; if (buttonBoundingBox.Contains(Event.current.mousePosition)) { //Debug.Log ("Mouse in button (" + i + ", " + j + ")"); nameStr = iter.Current.Value.name; infoStr = iter.Current.Value.description; } GUI.Label(new Rect(10, 10, 420, 30), nameStr, labelStyle); GUI.Label(new Rect(10, 40, 420, 80), infoStr, labelStyle); if (GUI.Button(buttonBoundingBox, iter.Current.Value.image.texture, button50x50Style) && !fadingOut) { if (player.GetComponent<AccessoryManager>() != null) { if (itemSrc != null) itemSrc.Play(); if (PlayerDataManager.itemEquipped == iter.Current.Key) player.GetComponent<AccessoryManager>().RemoveAccessory(); else player.GetComponent<AccessoryManager>().SetAccessory(iter.Current.Key); } } } else { //blank button GUI.Button(buttonBoundingBox, "", button50x50Style); } if (!iter.MoveNext()) { iterdone = true; break; } } if (iterdone) break; } } GUI.EndGroup (); } //Map layout - scrollable list of locations across levels //You can teleport instantly to any checkpoint you have visited from here if (currentTab == MenuTab.Map) { GUI.skin = scrollbarSkin; scrollPosition2 = GUI.BeginScrollView (new Rect (Screen.width / 2 - menuWidth / 2 + 10, Screen.height / 2 - menuHeight / 2 + 15 + tabButtonHeight, scrollViewWidth, scrollViewHeight), scrollPosition2, new Rect (0, 0, scrollViewWidth - 20, scrollViewHeight*2.5f)); GUI.skin = null; int i = 0; foreach (KeyValuePair<string, List<int> > entry in ImmutableData.GetLevelData()) { bool flag = false; foreach (int checkID in entry.Value) { if (PlayerDataManager.previousCheckpoints.Contains(checkID)) { flag = true; break; } } if (!flag) continue; GUI.Label (new Rect (10, i*50+10, scrollViewWidth-10, 50), entry.Key, labelStyle); for(int j = 1; j < entry.Value.Count+1; j++) { if (!PlayerDataManager.previousCheckpoints.Contains (entry.Value[j-1])) continue; i++; //GUI.Label (new Rect (10, i*50+j*50+10, scrollViewWidth-10, 50),"Checkpoint "+entry.Value[j-1]); GUI.Label (new Rect (10, i*50+10, scrollViewWidth-10, 50),ImmutableData.GetCheckpointData()[entry.Value[j-1]].name, labelStyle); if(GUI.Button (new Rect(250,i*50+10,120,50),"Teleport", button120x50Style) && !fadingOut) { if (teleportSrc != null) teleportSrc.Play(); teleportData = entry; teleportDataIndex = j-1; if (screenFadeObj != null) { screenFadeObj.GetComponent<ScreenFading>().fadeSpeed /= EPSILON; screenFadeObj.GetComponent<ScreenFading>().Transition(TeleportTransition, true); } else TeleportTransition(); } } i++; } GUI.EndScrollView (); } menuWasOpen = true; } else { menuWasOpen = false; Time.timeScale = 1; } }
/********* ** Public methods *********/ public PlannerMenu(MenuTab tabIndex, ModConfig config, Planner planner, ITranslationHelper i18n) : base(Game1.viewport.Width / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2) { this.Config = config; this.Planner = planner; this.TranslationHelper = i18n; this.CheckList = new CheckList(); this.Title = new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width / 2, this.yPositionOnScreen, Game1.tileSize * 4, Game1.tileSize), i18n.Get("title")); this.CurrentTab = tabIndex; { int i = 0; int labelX = (int)(this.xPositionOnScreen - Game1.tileSize * 4.8f); int labelY = (int)(this.yPositionOnScreen + Game1.tileSize * 1.5f); int labelHeight = (int)(Game1.tileSize * 0.9F); this.Tabs.Add(new ClickableComponent( new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Daily.ToString(), i18n.Get("tabs.daily"))); this.Tabs.Add(new ClickableComponent( new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Checklist.ToString(), i18n.Get("tabs.checklist"))); this.Tabs.Add(new ClickableComponent( new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Weekly.ToString(), i18n.Get("tabs.weekly"))); this.Tabs.Add(new ClickableComponent( new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Monthly.ToString(), i18n.Get("tabs.monthly"))); this.Tabs.Add(new ClickableComponent( new Rectangle(labelX, labelY + labelHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Add.ToString(), i18n.Get("tabs.add"))); } this.UpArrow = new ClickableTextureComponent( "up-arrow", new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 459, 11, 12), Game1.pixelZoom ); this.DownArrow = new ClickableTextureComponent( "down-arrow", new Rectangle(this.xPositionOnScreen + this.width + Game1.tileSize / 4, this.yPositionOnScreen + this.height - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 472, 11, 12), Game1.pixelZoom ); this.Scrollbar = new ClickableTextureComponent( "scrollbar", new Rectangle(this.UpArrow.bounds.X + Game1.pixelZoom * 3, this.UpArrow.bounds.Y + this.UpArrow.bounds.Height + Game1.pixelZoom, 6 * Game1.pixelZoom, 10 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(435, 463, 6, 10), Game1.pixelZoom ); this.ScrollbarRunner = new Rectangle( this.Scrollbar.bounds.X, this.UpArrow.bounds.Y + this.UpArrow.bounds.Height + Game1.pixelZoom, this.Scrollbar.bounds.Width, this.height - Game1.tileSize * 2 - this.UpArrow.bounds.Height - Game1.pixelZoom * 2 ); for (int i = 0; i < PlannerMenu.ItemsPerPage; i++) { this.OptionSlots.Add(new ClickableComponent( new Rectangle( this.xPositionOnScreen + Game1.tileSize / 4, this.yPositionOnScreen + Game1.tileSize * 5 / 4 + Game1.pixelZoom + i * ((this.height - Game1.tileSize * 2) / PlannerMenu.ItemsPerPage), this.width - Game1.tileSize / 2, (this.height - Game1.tileSize * 2) / PlannerMenu.ItemsPerPage + Game1.pixelZoom ), string.Concat(i) )); } int slotWidth = this.OptionSlots[0].bounds.Width; switch (this.CurrentTab) { case MenuTab.Daily: this.Options.Add(new OptionsElement( "Year " + StardewModdingAPI.Utilities.SDate.Now().Year.ToString() + ", " + StardewModdingAPI.Utilities.SDate.Now().Season + " " + StardewModdingAPI.Utilities.SDate.Now().Day.ToString() + ", " + StardewModdingAPI.Utilities.SDate.Now().DayOfWeek.ToString() + ":")); foreach (string task in this.Planner.GetDailyPlan()) { this.Options.Add(new DailyPlannerInputListener(task, slotWidth, this.Planner, this)); } break; case MenuTab.Checklist: foreach (string task in this.CheckList.GetCheckListItems()) { this.Options.Add(new DailyPlannerInputListener(task, slotWidth, this.CheckList, this)); } break; case MenuTab.Weekly: foreach (string line in this.Planner.CreateWeekList()) { this.Options.Add(new OptionsElement(line)); } break; case MenuTab.Monthly: foreach (string line in this.Planner.CreateMonthList()) { this.Options.Add(new OptionsElement(line)); } break; case MenuTab.Add: // TODO: Create "Add" Tab this.Options.Add(new OptionsElement("In-game task adding will")); this.Options.Add(new OptionsElement("come in a future update!")); break; } this.SetScrollBarToCurrentIndex(); }
private void OpenTab(MenuTab menuTab) { canvasGroup.alpha = 1; currentMenu = menuTab; TabsGroup.alpha = 1; TabsGroup.interactable = true; TabsGroup.blocksRaycasts = true; Time.timeScale = 0; hideGroups(); switch (currentMenu) { case MenuTab.Character: CharacterPreview.GetComponent<CanvasGroup>().alpha = 1; CharacterPreview.GetComponent<CanvasGroup>().interactable = true; CharacterPreview.GetComponent<CanvasGroup>().blocksRaycasts = true; CharacterAtributes.GetComponent<CanvasGroup>().alpha = 1; CharacterAtributes.GetComponent<CanvasGroup>().interactable = true; CharacterAtributes.GetComponent<CanvasGroup>().blocksRaycasts = true; CharacterAtributes.SetCharacterInfo(); MenuText.text = "Character"; break; case MenuTab.Stats: MenuText.text = "Stats"; break; case MenuTab.Feats: MenuText.text = "Feats"; FeatsMenu.GetComponent<CanvasGroup>().alpha = 1; FeatsMenu.GetComponent<CanvasGroup>().interactable = true; FeatsMenu.GetComponent<CanvasGroup>().blocksRaycasts = true; CharacterPreview.GetComponent<CanvasGroup>().alpha = 1; CharacterPreview.GetComponent<CanvasGroup>().interactable = true; CharacterPreview.GetComponent<CanvasGroup>().blocksRaycasts = true; FeatsMenu.SetAttacks(); break; case MenuTab.Inventory: Inventory.GetComponent<CanvasGroup>().alpha = 1; Inventory.GetComponent<CanvasGroup>().interactable = true; Inventory.GetComponent<CanvasGroup>().blocksRaycasts = true; CharacterPanel.GetComponent<CanvasGroup>().alpha = 1; CharacterPanel.GetComponent<CanvasGroup>().interactable = true; CharacterPanel.GetComponent<CanvasGroup>().blocksRaycasts = true; CharacterPreview.GetComponent<CanvasGroup>().alpha = 1; MenuText.text = "Inventory"; break; case MenuTab.Settings: MenuText.text = "Settings"; SettingsGroup.alpha = 1; SettingsGroup.interactable = true; SettingsGroup.blocksRaycasts = true; break; default: break; } }
//Closes submenus and resets selector to initial position public void Reset() { inSubMenu = false; selectorPosition = new Vector2(125, 132); currentTab = MenuTab.status; }
//Methods //Moves the green selection border through the menu or a submenu public void MoveSelector(KeyboardState kb, KeyboardState prevKb, GamePadState gp, GamePadState prevGp) { //Initialize direction Direction direction = Direction.down; //Interpret input and choose a direction //Direcitons take priority down > right > up > left if ((kb.IsKeyDown(Keys.S) == true && prevKb.IsKeyUp(Keys.S) == true) || (gp.ThumbSticks.Left.Y < -0.3 && prevGp.ThumbSticks.Left.Y > -0.3)) { direction = Direction.down; } else if ((kb.IsKeyDown(Keys.D) == true && prevKb.IsKeyUp(Keys.D) == true) || (gp.ThumbSticks.Left.X > 0.3 && prevGp.ThumbSticks.Left.X < 0.3)) { direction = Direction.right; } else if ((kb.IsKeyDown(Keys.W) == true && prevKb.IsKeyUp(Keys.W) == true) || (gp.ThumbSticks.Left.Y > 0.3 && prevGp.ThumbSticks.Left.Y < 0.3)) { direction = Direction.up; } else if ((kb.IsKeyDown(Keys.A) == true && prevKb.IsKeyUp(Keys.A) == true) || (gp.ThumbSticks.Left.X < -0.3 && prevGp.ThumbSticks.Left.X > -0.3)) { direction = Direction.left; } else { direction = Direction.none; } //Do things in the menu //The player has not entered a submenu if (inSubMenu == false && direction != Direction.none) { switch (direction) { //Move into displayed submenu if it has things to select case Direction.right: //Play bump sound break; //Move up one submenu, or wrap to bottom case Direction.up: if (currentTab > MenuTab.status) { currentTab = currentTab - 1; } else { currentTab = MenuTab.settings; } break; //Move down one submenu, or wrap to top case Direction.down: if (currentTab < MenuTab.settings) { currentTab = currentTab + 1; } else { currentTab = MenuTab.status; } break; case Direction.left: //Play bump sound break; } //Update Selector Data selectorPosition = new Vector2(125, 132 + 212 * (int)currentTab); } //when in a submenu else if (inSubMenu == true && direction != Direction.none) { switch (currentTab) { case MenuTab.status: //No submenu interaction break; case MenuTab.skills: //No submenu interaction break; case MenuTab.change: switch (direction) { case Direction.up: //Move to new orb if (selectedOrb >= 4) { selectedOrb -= 4; } //wrap to bottom of list else { selectedOrb += 16; } break; case Direction.down: //Move to new orb if (selectedOrb < 16) { selectedOrb += 4; } //wrap to top of list else { selectedOrb -= 16; } break; case Direction.left: //Move to new orb if (selectedOrb % 4 != 0) { selectedOrb -= 1; } //Wrap to right of list else { selectedOrb += 3; } break; case Direction.right: //Move to new orb if (selectedOrb % 4 != 3) { selectedOrb += 1; } //Wrap to right of list else { selectedOrb -= 3; } break; } //Update Small Selector Data selectorPosition = new Vector2(725 + 158 * ((int)selectedOrb % 4), 148 + 159 * (int)(selectedOrb / 4)); break; case MenuTab.settings: //Will have interaction, one day break; } } //Press A to move into current submenu else if (inSubMenu == false && (kb.IsKeyDown(Keys.Space) == true && (prevKb.IsKeyUp(Keys.Space) == true) || (gp.IsButtonDown(Buttons.A) == true && prevGp.IsButtonUp(Buttons.A) == true))) { if (currentTab == MenuTab.change) { inSubMenu = true; //Set initial small selector position selectorPosition = new Vector2(725 + 158 * ((int)selectedOrb % 4), 148 + 159 * (int)(selectedOrb / 4)); } } //Press B to return to main menu from submenu else if (InSubMenu == true && (kb.IsKeyDown(Keys.R) == true && (prevKb.IsKeyUp(Keys.R) == true) || (gp.IsButtonDown(Buttons.B) == true && prevGp.IsButtonUp(Buttons.B) == true))) { inSubMenu = false; //Return large selector to correct position selectorPosition = new Vector2(125, 132 + 212 * (int)currentTab); } }
// Use this for initialization void Start() { currentMenu = MenuTab.Character; canvasGroup = GetComponent<CanvasGroup>(); TabsGroup.alpha = 0; TabsGroup.interactable = false; hideGroups(); }
public void OpenMenu(MenuTab menuTab) { OpenTab(menuTab); }