public override void Update() { int num = (int)this._selection; if (this._desiredScreen != this._screen) { this._fade = Lerp.Float(this._fade, 0.0f, 0.06f); if ((double)this._fade <= 0.0) { this._screen = this._desiredScreen; if (this._screen == LockerScreen.Stats) { this._statScroll = 0.0f; HUD.AddCornerControl(HUDCorner.BottomLeft, "MOVE@DPAD@"); HUD.AddCornerMessage(HUDCorner.TopLeft, this._profile.name); HUD.AddCornerControl(HUDCorner.TopRight, "@QUACK@BACK"); } else if (this._screen == LockerScreen.Trophies) { this._statScroll = 0.0f; HUD.AddCornerControl(HUDCorner.BottomLeft, "MOVE@DPAD@"); HUD.AddCornerMessage(HUDCorner.TopLeft, "TROPHIES"); HUD.AddCornerControl(HUDCorner.TopRight, "@QUACK@BACK"); } else if (this._screen == LockerScreen.Locker) { HUD.AddCornerControl(HUDCorner.BottomLeft, "MOVE@DPAD@"); HUD.AddCornerMessage(HUDCorner.TopLeft, "LOCKER ROOM"); HUD.AddCornerControl(HUDCorner.TopRight, "@QUACK@EXIT"); } else if (this._screen == LockerScreen.Exit) { Graphics.fade = 0.0f; Level.current = (Level) new DoorRoom(this._profile); } } } else { this._fade = Lerp.Float(this._fade, 1f, 0.06f); if (this._screen == LockerScreen.Locker) { if (InputProfile.active.Pressed("LEFT")) { --num; if (num < 0) { num = 1; } } if (InputProfile.active.Pressed("RIGHT")) { ++num; if (num >= 2) { num = 0; } } this._selection = (LockerSelection)num; if (InputProfile.active.Pressed("SELECT")) { if (this._selection == LockerSelection.Stats) { this._desiredScreen = LockerScreen.Stats; HUD.CloseAllCorners(); } if (this._selection == LockerSelection.Trophies) { this._desiredScreen = LockerScreen.Trophies; HUD.CloseAllCorners(); } } if (InputProfile.active.Pressed("QUACK")) { this._desiredScreen = LockerScreen.Exit; HUD.CloseAllCorners(); } } else if (this._screen == LockerScreen.Stats) { if (InputProfile.active.Down("UP")) { this._statScroll -= 0.02f; if ((double)this._statScroll < 0.0) { this._statScroll = 0.0f; } } if (InputProfile.active.Down("DOWN")) { this._statScroll += 0.02f; if ((double)this._statScroll > 1.0) { this._statScroll = 1f; } } if (InputProfile.active.Pressed("QUACK")) { this._desiredScreen = LockerScreen.Exit; HUD.CloseAllCorners(); } if (this._clearStats.value) { this._clearStats.value = false; this._profile.stats = new ProfileStats(); Profiles.Save(this._profile); Level.current = (Level) new LockerRoom(this._profile); } if (InputProfile.active.Pressed("GRAB")) { MonoMain.pauseMenu = this._confirmGroup; this._confirmGroup.Open(); this._confirmMenu.Open(); } } else if (this._screen == LockerScreen.Trophies && InputProfile.active.Pressed("QUACK")) { this._desiredScreen = LockerScreen.Locker; HUD.CloseAllCorners(); } } base.Update(); }
public override void Update() { if (this.open) { if (this._doLobbySearch && this._lobbies.Count == 0) { this._lobbies.Clear(); this._doLobbySearch = false; Steam.SearchForLobby((User)null); } if (!this._doLobbySearch && this._lobbies.Count == 0 && Steam.lobbySearchComplete) { int lobbiesFound = Steam.lobbiesFound; List <WorkshopItem> items = new List <WorkshopItem>(); for (int index = 0; index < lobbiesFound; ++index) { Lobby searchLobbyAtIndex = Steam.GetSearchLobbyAtIndex(index); UIServerBrowser.LobbyData lobbyData1 = new UIServerBrowser.LobbyData(); lobbyData1.lobby = searchLobbyAtIndex; string str1 = searchLobbyAtIndex.GetLobbyData("name"); if (str1 == null || str1 == "") { str1 = "DG Lobby"; } lobbyData1.name = str1; lobbyData1.modHash = searchLobbyAtIndex.GetLobbyData("modhash"); lobbyData1.requiredWins = searchLobbyAtIndex.GetLobbyData("requiredwins"); lobbyData1.restsEvery = searchLobbyAtIndex.GetLobbyData("restsevery"); lobbyData1.wallMode = searchLobbyAtIndex.GetLobbyData("wallmode"); lobbyData1.customLevels = searchLobbyAtIndex.GetLobbyData("customLevels"); lobbyData1.version = searchLobbyAtIndex.GetLobbyData("version"); lobbyData1.started = searchLobbyAtIndex.GetLobbyData("started"); lobbyData1.type = searchLobbyAtIndex.GetLobbyData("type"); lobbyData1.numSlots = searchLobbyAtIndex.GetLobbyData("numSlots"); string lobbyData2 = searchLobbyAtIndex.GetLobbyData("mods"); if (lobbyData2 != null && lobbyData2 != "") { string str2 = lobbyData2; char[] chArray = new char[1] { '|' }; foreach (string str3 in str2.Split(chArray)) { if (str3 == "LOCAL") { lobbyData1.hasLocalMods = true; } else { WorkshopItem workshopItem = WorkshopItem.GetItem(Convert.ToUInt64(str3)); items.Add(workshopItem); lobbyData1.workshopItems.Add(workshopItem); } } } lobbyData1.maxPlayers = searchLobbyAtIndex.GetLobbyData("maxplayers"); this._lobbies.Add(lobbyData1); } if (items.Count > 0) { Steam.RequestWorkshopInfo(items); } this._doLobbySearch = true; } } if (this._pressWait > 0) { --this._pressWait; } if (this._downloadModsMenu.open) { this._downloadModsMenu.DoUpdate(); if (!UIMenu.globalUILock && (Input.Pressed("QUACK") || Keyboard.Pressed(Keys.Escape))) { this._downloadModsMenu.Close(); this.Open(); return; } } else if (this.open) { if (this._gamepadMode) { if (this._hoverIndex < 0) { this._hoverIndex = 0; } } else { this._hoverIndex = -1; for (int index = 0; index < this._maxLobbiesToShow && this._scrollItemOffset + index < this._lobbies.Count; ++index) { if (new Rectangle((float)(int)(this._box.x - this._box.halfWidth), (float)(int)(this._box.y - this._box.halfHeight + (float)(36 * index)), (float)((int)this._box.width - 14), 36f).Contains(Mouse.position)) { this._hoverIndex = this._scrollItemOffset + index; break; } } } if (this._hoverIndex != -1) { if (Input.Pressed("SHOOT")) { this.RefreshLobbySearch(); SFX.Play("rockHitGround", 0.8f); } if (this._lobbies.Count > 0) { UIServerBrowser._selectedLobby = this._lobbies[this._hoverIndex]; if (Input.Pressed("SELECT") && this._pressWait == 0 && this._gamepadMode || !this._gamepadMode && Mouse.left == InputState.Pressed) { if (!UIServerBrowser._selectedLobby.canJoin) { SFX.Play("consoleError"); } else { SFX.Play("consoleSelect"); if (UIServerBrowser._selectedLobby.workshopItems.Count == 0 || UIServerBrowser._selectedLobby.hasFirstMod && UIServerBrowser._selectedLobby.hasRestOfMods) { MonoMain.pauseMenu = (UIComponent)null; MonoMain.closeMenuUpdate.Clear(); Level.current = (Level) new JoinServer(UIServerBrowser._selectedLobby.lobby.id); return; } new UIMenuActionOpenMenu((UIComponent)this, (UIComponent)this._downloadModsMenu).Activate(); } } } } else { UIServerBrowser._selectedLobby = (UIServerBrowser.LobbyData)null; } if (this._gamepadMode) { this._draggingScrollbar = false; if (Input.Pressed("DOWN")) { ++this._hoverIndex; } else if (Input.Pressed("UP")) { --this._hoverIndex; } if (Input.Pressed("STRAFE")) { this._hoverIndex -= 10; } else if (Input.Pressed("RAGDOLL")) { this._hoverIndex += 10; } if (this._hoverIndex < 0) { this._hoverIndex = 0; } if ((double)(this._oldPos - Mouse.positionScreen).lengthSq > 200.0) { this._gamepadMode = false; } } else { if (!this._draggingScrollbar) { if (Mouse.left == InputState.Pressed && this.ScrollBarBox().Contains(Mouse.position)) { this._draggingScrollbar = true; this._oldPos = Mouse.position; } if ((double)Mouse.scroll > 0.0) { this._scrollItemOffset += 5; this._hoverIndex += 5; } else if ((double)Mouse.scroll < 0.0) { this._scrollItemOffset -= 5; this._hoverIndex -= 5; if (this._hoverIndex < 0) { this._hoverIndex = 0; } } } else if (Mouse.left != InputState.Down) { this._draggingScrollbar = false; } else { Vec2 vec2 = Mouse.position - this._oldPos; this._oldPos = Mouse.position; this.scrollBarOffset += (int)vec2.y; if (this.scrollBarOffset > this.scrollBarScrollableHeight) { this.scrollBarOffset = this.scrollBarScrollableHeight; } else if (this.scrollBarOffset < 0) { this.scrollBarOffset = 0; } this._scrollItemOffset = (int)((double)(this._lobbies.Count - this._maxLobbiesToShow) * (double)((float)this.scrollBarOffset / (float)this.scrollBarScrollableHeight)); } if (Input.Pressed("ANY")) { this._gamepadMode = true; this._oldPos = Mouse.positionScreen; } } if (this._scrollItemOffset < 0) { this._scrollItemOffset = 0; } else if (this._scrollItemOffset > Math.Max(0, this._lobbies.Count - this._maxLobbiesToShow)) { this._scrollItemOffset = Math.Max(0, this._lobbies.Count - this._maxLobbiesToShow); } if (this._hoverIndex >= this._lobbies.Count) { this._hoverIndex = this._lobbies.Count - 1; } else if (this._hoverIndex >= this._scrollItemOffset + this._maxLobbiesToShow) { this._scrollItemOffset += this._hoverIndex - (this._scrollItemOffset + this._maxLobbiesToShow) + 1; } else if (this._hoverIndex >= 0 && this._hoverIndex < this._scrollItemOffset) { this._scrollItemOffset -= this._scrollItemOffset - this._hoverIndex; } this.scrollBarOffset = this._scrollItemOffset == 0 ? 0 : (int)Lerp.FloatSmooth(0.0f, (float)this.scrollBarScrollableHeight, (float)this._scrollItemOffset / (float)(this._lobbies.Count - this._maxLobbiesToShow)); if (!Editor.hoverTextBox && !UIMenu.globalUILock && (Input.Pressed("QUACK") || Keyboard.Pressed(Keys.Escape))) { new UIMenuActionOpenMenu((UIComponent)this, (UIComponent)this._openOnClose).Activate(); return; } } if (this._showingMenu) { HUD.CloseAllCorners(); this._showingMenu = false; } base.Update(); }
public override void Initialize() { this._background = new Sprite("gym"); this._boardHighlight = new Sprite("boardHighlight"); this._boardHighlight.CenterOrigin(); this._trophiesHighlight = new Sprite("trophiesHighlight"); this._trophiesHighlight.CenterOrigin(); HUD.AddCornerControl(HUDCorner.BottomLeft, "MOVE@DPAD@"); HUD.AddCornerMessage(HUDCorner.TopLeft, this._profile.name); HUD.AddCornerControl(HUDCorner.TopRight, "@QUACK@EXIT"); HUD.AddCornerControl(HUDCorner.BottomRight, "@GRAB@RESET"); this.backgroundColor = Color.Black; this._confirmGroup = new UIComponent(Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 0.0f, 0.0f); this._confirmMenu = new UIMenu("CLEAR STATS?", Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 160f, conString: "@SELECT@SELECT"); this._confirmMenu.Add((UIComponent) new UIMenuItem("NO!", (UIMenuAction) new UIMenuActionCloseMenu(this._confirmGroup)), true); this._confirmMenu.Add((UIComponent) new UIMenuItem("YES!", (UIMenuAction) new UIMenuActionCloseMenuSetBoolean(this._confirmGroup, this._clearStats)), true); this._confirmMenu.Close(); this._confirmGroup.Add((UIComponent)this._confirmMenu, false); this._confirmGroup.Close(); Level.Add((Thing)this._confirmGroup); Profile profile = this._profile; this._stats.Add(new LockerStat("KILLS: " + Change.ToString((object)profile.stats.kills), Color.GreenYellow)); this._stats.Add(new LockerStat("DEATHS: " + Change.ToString((object)profile.stats.timesKilled), Color.Red)); this._stats.Add(new LockerStat("SUICIDES: " + Change.ToString((object)profile.stats.suicides), Color.Red)); this._stats.Add(new LockerStat("", Color.Red)); this._stats.Add(new LockerStat("ROUNDS WON: " + Change.ToString((object)profile.stats.matchesWon), Color.GreenYellow)); this._stats.Add(new LockerStat("ROUNDS LOST: " + Change.ToString((object)(profile.stats.timesSpawned - profile.stats.matchesWon)), Color.Red)); this._stats.Add(new LockerStat("GAMES WON: " + Change.ToString((object)profile.stats.trophiesWon), Color.GreenYellow)); this._stats.Add(new LockerStat("GAMES LOST: " + Change.ToString((object)(profile.stats.gamesPlayed - profile.stats.trophiesWon)), Color.Red)); this._stats.Add(new LockerStat("", Color.Red)); this._stats.Add(new LockerStat("FANS: " + Change.ToString((object)profile.stats.GetFans()), Color.Lime)); int fans = profile.stats.GetFans(); int num1 = 0; if (fans > 0) { num1 = (int)Math.Round((double)profile.stats.loyalFans / (double)profile.stats.GetFans() * 100.0); } this._stats.Add(new LockerStat("FAN LOYALTY: " + Change.ToString((object)num1) + "%", Color.Lime)); this._stats.Add(new LockerStat("", Color.Red)); float num2 = 0.0f; if (profile.stats.bulletsFired > 0) { num2 = (float)profile.stats.bulletsThatHit / (float)profile.stats.bulletsFired; } this._stats.Add(new LockerStat("ACCURACY: " + Change.ToString((object)(int)Math.Round((double)num2 * 100.0)) + "%", (double)num2 > 0.600000023841858 ? Color.Green : Color.Red)); this._stats.Add(new LockerStat("", Color.Red)); this._stats.Add(new LockerStat("TIMES QUACKED: " + Change.ToString((object)profile.stats.quacks), Color.Orange)); this._stats.Add(new LockerStat("MINES STEPPED ON: " + Change.ToString((object)profile.stats.minesSteppedOn), Color.Orange)); this._stats.Add(new LockerStat("PRESENTS OPENED: " + Change.ToString((object)profile.stats.presentsOpened), Color.Orange)); this._stats.Add(new LockerStat("", Color.Red)); this._stats.Add(new LockerStat("SPIRITUALITY", Color.White)); this._stats.Add(new LockerStat("FUNERALS: " + Change.ToString((object)profile.stats.funeralsPerformed), Color.Orange)); this._stats.Add(new LockerStat("CONVERSIONS: " + Change.ToString((object)profile.stats.conversions), Color.Orange)); this._stats.Add(new LockerStat("", Color.Red)); this._stats.Add(new LockerStat("TIME SPENT", Color.White)); this._stats.Add(new LockerStat("IN NET: " + Change.ToString((object)(int)profile.stats.timeInNet) + " SECONDS", Color.Orange)); this._stats.Add(new LockerStat("ON FIRE: " + Change.ToString((object)(int)profile.stats.timeOnFire) + " SECONDS", Color.Orange)); this._stats.Add(new LockerStat("BRAINWASHED: " + Change.ToString((object)(int)profile.stats.timeUnderMindControl) + " SECONDS", Color.Orange)); this._stats.Add(new LockerStat("MOUTH OPEN: " + Change.ToString((object)(int)profile.stats.timeWithMouthOpen) + " SECONDS", Color.Orange)); base.Initialize(); }