public UIServerBrowser( UIMenu openOnClose, string title, float xpos, float ypos, float wide = -1f, float high = -1f, string conString = "", InputProfile conProfile = null) : base(title, xpos, ypos, wide, high, conString, conProfile) { this.defaultImage = Content.Load <Tex2D>("server_default"); this._splitter.topSection.components[0].align = UIAlign.Left; this._openOnClose = openOnClose; this._moreArrow = new Sprite("moreArrow"); this._moreArrow.CenterOrigin(); this._steamIcon = new Sprite("steamIconSmall"); this._steamIcon.scale = new Vec2(1f) / 2f; this._localIcon = new SpriteMap("iconSheet", 16, 16); this._localIcon.scale = new Vec2(1f) / 2f; this._localIcon.SetFrameWithoutReset(1); this._newIcon = new SpriteMap("presents", 16, 16); this._newIcon.scale = new Vec2(2f); this._newIcon.SetFrameWithoutReset(0); this._noImage = new Sprite("notexture"); this._noImage.scale = new Vec2(2f); this._cursor = new SpriteMap("cursors", 16, 16); this._maxLobbiesToShow = 8; this._box = new UIBox(0.0f, 0.0f, high: ((float)(this._maxLobbiesToShow * 36)), isVisible: false); this.Add((UIComponent)this._box, true); this._fancyFont = new FancyBitmapFont("smallFont"); this._fancyFont.maxWidth = (int)this.width - 100; this._fancyFont.maxRows = 2; this.scrollBarOffset = 0; this._editModMenu = new UIMenu("<mod name>", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._editModMenu.Add((UIComponent) new UIText(" ", Color.White), true); this._editModMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._editModMenu, (UIComponent)this)), true); this._editModMenu.Close(); this._yesNoMenu = new UIMenu("ARE YOU SURE?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._yesNoMenu.Add((UIComponent)(this._yesNoYes = new UIMenuItem("YES")), true); this._yesNoMenu.Add((UIComponent)(this._yesNoNo = new UIMenuItem("NO")), true); this._yesNoMenu.Close(); this._updateTextBox = new Textbox(0.0f, 0.0f, 0.0f, 0.0f); this._updateTextBox.depth = new Depth(0.9f); this._updateTextBox.maxLength = 5000; this._downloadModsMenu = new UIMenu("MODS REQUIRED!", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 290f, conString: "@SELECT@SELECT"); this._downloadModsMenu.Add((UIComponent) new UIText("You're missing the mods required", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIText("to join this game. Would you", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIText("like to automatically subscribe to", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIText("all required mods, restart and", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIText("join the game?", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIText("", Colors.DGBlue), true); this._downloadModsMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._downloadModsMenu, (UIComponent)this)), true); this._downloadModsMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCloseMenuCallFunction((UIComponent)this._downloadModsMenu, new UIMenuActionCloseMenuCallFunction.Function(UIServerBrowser.SubscribeAndRestart))), true); this._downloadModsMenu.Close(); }
public override void Insert(UIComponent component, int position, bool doAnchor = true) { if (component is UIMenuItem) { this._isMenu = true; if ((component as UIMenuItem).isBackButton) { this._backButton = component as UIMenuItem; } } base.Insert(component, position, doAnchor); }
public override void Add(UIComponent component, bool doAnchor = true) { if (component is UIMenuItem) { this._isMenu = true; if ((component as UIMenuItem).isBackButton) { this._backButton = component as UIMenuItem; } } base.Add(component, doAnchor); }
public UIModManagement( UIMenu openOnClose, string title, float xpos, float ypos, float wide = -1f, float high = -1f, string conString = "", InputProfile conProfile = null) : base(title, xpos, ypos, wide, high, conString, conProfile) { this._splitter.topSection.components[0].align = UIAlign.Left; this._openOnClose = openOnClose; this._moreArrow = new Sprite("moreArrow"); this._moreArrow.CenterOrigin(); this._steamIcon = new Sprite("steamIconSmall"); this._steamIcon.scale = new Vec2(1f) / 2f; this._localIcon = new SpriteMap("iconSheet", 16, 16); this._localIcon.scale = new Vec2(1f) / 2f; this._localIcon.SetFrameWithoutReset(1); this._newIcon = new SpriteMap("presents", 16, 16); this._newIcon.scale = new Vec2(2f); this._newIcon.SetFrameWithoutReset(0); this._noImage = new Sprite("notexture"); this._noImage.scale = new Vec2(2f); this._cursor = new SpriteMap("cursors", 16, 16); this._mods = (IList <Mod>)ModLoader.allMods.Where <Mod>((Func <Mod, bool>)(a => !(a is CoreMod))).ToList <Mod>(); this._mods.Add((Mod)null); this._maxModsToShow = 8; this._box = new UIBox(0.0f, 0.0f, high: ((float)(this._maxModsToShow * 36)), isVisible: false); this.Add((UIComponent)this._box, true); this._fancyFont = new FancyBitmapFont("smallFont"); this._fancyFont.maxWidth = (int)this.width - 100; this._fancyFont.maxRows = 2; this.scrollBarOffset = 0; this._editModMenu = new UIMenu("<mod name>", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._editModMenu.Add((UIComponent)(this._disableOrEnableItem = new UIMenuItem("DISABLE", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.EnableDisableMod)))), true); this._deleteOrUnsubItem = new UIMenuItem("DELETE", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.DeleteMod))); this._uploadItem = new UIMenuItem("UPLOAD", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.UploadMod))); this._visitItem = new UIMenuItem("VISIT PAGE", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.VisitModPage))); this._editModMenu.Add((UIComponent) new UIText(" ", Color.White), true); this._editModMenu.Add((UIComponent) new UIMenuItem("BACK", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._editModMenu, (UIComponent)this)), true); this._editModMenu.Close(); this._yesNoMenu = new UIMenu("ARE YOU SURE?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._yesNoMenu.Add((UIComponent)(this._yesNoYes = new UIMenuItem("YES")), true); this._yesNoMenu.Add((UIComponent)(this._yesNoNo = new UIMenuItem("NO")), true); this._yesNoMenu.Close(); this._updateTextBox = new Textbox(0.0f, 0.0f, 0.0f, 0.0f); this._updateTextBox.depth = new Depth(0.9f); this._updateTextBox.maxLength = 5000; }
public UIControlConfig( UIMenu openOnClose, string title, float xpos, float ypos, float wide = -1f, float high = -1f, string conString = "", InputProfile conProfile = null) : base(title, xpos, ypos, wide, high, conString, conProfile) { this._openOnClose = openOnClose; List <string> stringList1 = new List <string>() { "P1 ", "P2 ", "P3 ", "P4" }; List <string> stringList2 = new List <string>() { "GAMEPAD", "KEYBOARD", "PAD + KEYS" }; BitmapFont bitmapFont = new BitmapFont("smallBiosFontUI", 7, 5); UIBox uiBox = new UIBox(isVisible: false); this._configuringToggle = new UIMenuItemToggle("", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.SwitchConfigType)), new FieldBinding((object)this, nameof(inputConfigType)), multi: this.inputTypes, compressedMulti: true, tiny: true); uiBox.Add((UIComponent)this._configuringToggle, true); UIText uiText1 = new UIText(" ", Color.White); this._controlElements.Add(new UIControlElement("|DGBLUE|{LEFT", "LEFT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|/RIGHT", "RIGHT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|}UP", "UP", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|~DOWN", "DOWN", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|START", "START", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|ACCEPT", "SELECT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|JUMP", "JUMP", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|GRAB", "GRAB", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|TRIP", "RAGDOLL", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|FIRE", "SHOOT", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|STRAFE", "STRAFE", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGBLUE|QUACK", "QUACK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|L STICK", "LSTICK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|R STICK", "RSTICK", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|L TRIGGER", "LTRIGGER", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); this._controlElements.Add(new UIControlElement("|DGGREEN|R TRIGGER", "RTRIGGER", new DeviceInputMapping(), field: new FieldBinding((object)Options.Data, "sfxVolume"))); uiBox.Add((UIComponent)this._controlElements[this._controlElements.Count - 1], true); UIMenuItem uiMenuItem = new UIMenuItem("|RED|REVERT TO DEFAULT", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.ResetToDefault))); uiMenuItem.SetFont(bitmapFont); uiBox.Add((UIComponent)uiMenuItem, true); UIText uiText2 = new UIText(" ", Color.White); uiText2.SetFont(bitmapFont); uiBox.Add((UIComponent)uiText2, true); UIText uiText3 = new UIText("PERSONAL CONTROLS CAN BE", Color.White); uiText3.SetFont(bitmapFont); uiBox.Add((UIComponent)uiText3, true); UIText uiText4 = new UIText("SET IN PROFILE SCREEN", Color.White); uiText4.SetFont(bitmapFont); uiBox.Add((UIComponent)uiText4, true); this._controlBox = uiBox; this._playerBoxes.Add(uiBox); this.Add((UIComponent)this._playerBoxes[0], true); this._confirmMenu = new UIMenu("SAVE CHANGES?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._confirmMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.CloseMenuSaving))), true); this._confirmMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionCallFunction(new UIMenuActionCallFunction.Function(this.CloseMenu))), true); this._confirmMenu.Add((UIComponent) new UIMenuItem("CANCEL!", (UIMenuAction) new UIMenuActionOpenMenu((UIComponent)this._confirmMenu, (UIComponent)this)), true); this._confirmMenu.Close(); }
public override void Update() { if (!UIMenu.globalUILock && this._isMenu && !this._close) { bool flag = false; if (this._vertical) { if (!this._animating && Input.Pressed("UP")) { --this._selection; flag = true; } if (!this._animating && Input.Pressed("DOWN")) { ++this._selection; flag = true; } } else { if (!this._animating && Input.Pressed("LEFT")) { --this._selection; flag = true; } if (!this._animating && Input.Pressed("RIGHT")) { ++this._selection; flag = true; } } if (this._backButton != null && !this._animating && Input.Pressed("QUACK")) { this._backButton.Activate("SELECT"); } List <UIComponent> list = this._components.Where <UIComponent>((Func <UIComponent, bool>)(val => val is UIMenuItem)).ToList <UIComponent>(); if (this._selection >= list.Count) { this._selection = 0; } else if (this._selection < 0) { this._selection = list.Count - 1; } if (flag) { SFX.Play("textLetter", 0.7f); } this._hoverControlString = (string)null; for (int index = 0; index < list.Count; ++index) { UIMenuItem uiMenuItem = list[index] as UIMenuItem; uiMenuItem.selected = index == this._selection; if (index == this._selection) { this._hoverControlString = uiMenuItem.controlString; if (uiMenuItem.isEnabled) { if (!this._animating && (Input.Pressed("SELECT") || Input.Pressed("SHOOT") || Input.Pressed("START"))) { uiMenuItem.Activate("SELECT"); SFX.Play("rockHitGround", 0.7f); } else if (!this._animating && Input.Pressed("GRAB")) { uiMenuItem.Activate("GRAB"); } else if (!this._animating && Input.Pressed("LEFT")) { uiMenuItem.Activate("LEFT"); } else if (!this._animating && Input.Pressed("RIGHT")) { uiMenuItem.Activate("RIGHT"); } } } } } base.Update(); }