Exemple #1
0
 public override void Update()
 {
     if (this.open)
     {
         if (!UIMenu.globalUILock && (Input.Pressed("QUACK") || Keyboard.Pressed(Keys.Escape)))
         {
             new UIMenuActionOpenMenu((UIComponent)this, (UIComponent)this._confirmMenu).Activate();
             return;
         }
         if (Input.uiDevicesHaveChanged)
         {
             this.SwitchPlayerProfile();
             Input.uiDevicesHaveChanged = false;
         }
     }
     if (this._controlBox.selection > 0 && this._controlBox.selection < 17)
     {
         if (!this._showingMenu && this.inputConfigType < this.inputMaps.Count && (this.inputMaps[this.inputConfigType].deviceName != "KEYBOARD P1" && this.inputMaps[this.inputConfigType].deviceName != "KEYBOARD P2"))
         {
             HUD.AddCornerControl(HUDCorner.BottomLeft, "STYLE@GRAB@");
             this._showingMenu = true;
         }
     }
     else if (this._showingMenu)
     {
         HUD.CloseAllCorners();
         this._showingMenu = false;
     }
     base.Update();
 }
Exemple #2
0
 public void CloseMenu()
 {
     this._showingMenu = false;
     this.Close();
     this._openOnClose.Open();
     this._confirmMenu.Close();
     this.inputMaps.Clear();
     HUD.CloseAllCorners();
 }
Exemple #3
0
 public static void OpenVoting(string voteMessage, string voteButton, bool openCorners = true)
 {
     if (openCorners)
     {
         Vote._voteButton = voteButton;
         HUD.CloseAllCorners();
         HUD.AddCornerControl(HUDCorner.BottomRight, "@" + voteButton + "@" + voteMessage);
     }
     Vote._votingOpen = true;
 }
Exemple #4
0
 public void CloseMenuSaving()
 {
     this._showingMenu = false;
     foreach (DeviceInputMapping inputMap in this.inputMaps)
     {
         Input.SetDefaultMapping(inputMap);
     }
     Input.ApplyDefaultMappings();
     Input.Save();
     this.Close();
     this._openOnClose.Open();
     this._confirmMenu.Close();
     this.inputMaps.Clear();
     HUD.CloseAllCorners();
 }
        public override void Update()
        {
            bool hover = this.hover;
            Duck duck  = Level.Nearest <Duck>(this.x, this.y);

            this.hover = duck != null && (double)(duck.position - (this.position + new Vec2(8f, 0.0f))).length < 16.0;
            if (!hover && this.hover)
            {
                HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@PROFILE");
            }
            else if (hover && !this.hover)
            {
                HUD.CloseAllCorners();
            }
            this._consoleFade = Lerp.Float(this._consoleFade, this.hover ? 1f : 0.0f, 0.1f);
            base.Update();
        }
 public override void Open()
 {
     HUD.CloseAllCorners();
     HUD.AddCornerControl(HUDCorner.BottomLeft, "INVITE@SHOOT@");
     HUD.AddCornerControl(HUDCorner.BottomRight, "@QUACK@EXIT");
     this._users.Clear();
     if (Steam.IsInitialized())
     {
         IOrderedEnumerable <User> source1 = Steam.friends.OrderBy <User, int>((Func <User, int>)(u => UIInviteMenu._sortDictionary[(int)u.state]));
         int num = source1.Count <User>();
         for (int index = 0; index < num; ++index)
         {
             User   u       = source1.ElementAt <User>(index);
             string source2 = u.name;
             if (source2.Count <char>() > 17)
             {
                 source2 = source2.Substring(0, 16) + ".";
             }
             UserInfo info = u.info;
             if (info.relationship == FriendRelationship.Friend)
             {
                 this._users.Add(new UIInviteUser()
                 {
                     user       = u,
                     sprite     = UIInviteMenu.GetAvatar(u),
                     state      = info.state,
                     name       = source2,
                     inGame     = info.inGame,
                     inDuckGame = info.inCurrentGame,
                     inMyLobby  = info.inLobby
                 });
             }
         }
         this._users = this._users.OrderBy <UIInviteUser, UIInviteUser>((Func <UIInviteUser, UIInviteUser>)(h => h), (IComparer <UIInviteUser>) new CompareUsers()).ToList <UIInviteUser>();
     }
     base.Open();
 }
 public void OnSessionEnded(DuckNetErrorInfo error)
 {
     if (!this.open)
     {
         return;
     }
     if (UIMatchmakingBox._state == MatchmakingState.Disconnect)
     {
         if (this._tryHostingLobby != null)
         {
             this._tries = 0;
         }
         this._tryHostingLobby = (Lobby)null;
         if (this._quit)
         {
             HUD.CloseAllCorners();
             this.Close();
             this._openOnClose.Open();
         }
         else if (this._tryConnectLobby != null)
         {
             DuckNetwork.Join(this._tryConnectLobby.id.ToString());
             this.ChangeState(MatchmakingState.Connecting);
         }
         else
         {
             this.ChangeState(MatchmakingState.SearchForLobbies);
         }
     }
     else
     {
         if (error != null)
         {
             if (error.error == DuckNetError.VersionMismatch)
             {
                 if (error.tooNew)
                 {
                     this._newStatusList.Add("|DGRED|Their version was older.");
                 }
                 else
                 {
                     this._newStatusList.Add("|DGRED|Their version was newer.");
                 }
                 if (this._tryConnectLobby != null)
                 {
                     this._permenantBlacklist.Add(new BlacklistServer()
                     {
                         lobby    = this._tryConnectLobby.id,
                         cooldown = 15f
                     });
                 }
             }
             else if (error.error == DuckNetError.FullServer)
             {
                 this._newStatusList.Add("|DGRED|Failed (FULL SERVER)");
             }
             else if (error.error == DuckNetError.ConnectionTimeout)
             {
                 this._newStatusList.Add("|DGRED|Failed (TIMEOUT)");
             }
             else if (error.error == DuckNetError.GameInProgress)
             {
                 this._newStatusList.Add("|DGRED|Failed (IN PROGRESS)");
             }
             else
             {
                 this._newStatusList.Add("|DGRED|Unknown connection error.");
                 if (this._tryConnectLobby != null)
                 {
                     this._permenantBlacklist.Add(new BlacklistServer()
                     {
                         lobby    = this._tryConnectLobby.id,
                         cooldown = 15f
                     });
                 }
             }
         }
         else
         {
             this._newStatusList.Add("|DGRED|Connection timeout.");
             if (this._tryConnectLobby != null)
             {
                 this._permenantBlacklist.Add(new BlacklistServer()
                 {
                     lobby    = this._tryConnectLobby.id,
                     cooldown = 15f
                 });
             }
         }
         if (this._tryConnectLobby != null)
         {
             this._failedAttempts.Add(new BlacklistServer()
             {
                 lobby    = this._tryConnectLobby.id,
                 cooldown = 15f
             });
         }
         DevConsole.Log("|PURPLE|MATCHMAKING |DGGREEN|Connection failure, continuing search.", Color.White);
         this._tryConnectLobby = (Lobby)null;
         this.ChangeState(MatchmakingState.SearchForLobbies);
     }
 }
 public override void UpdateParts()
 {
     if (!this.doubleUpdating && Input.Down("JUMP"))
     {
         this.doubleUpdating = true;
         this.UpdateParts();
         this.doubleUpdating = false;
     }
     if ((double)this.yOffset < 1.0)
     {
         if ((double)this._insertCoin < 1.0)
         {
             this._insertCoinInc += 0.008f;
             this._insertCoin    += this._insertCoinInc;
         }
         else
         {
             if (!this._chinged)
             {
                 SFX.Play("ching", pitch: Rando.Float(0.4f, 0.6f));
                 this._chinged = true;
             }
             this._insertCoin = 1f;
             if ((double)this._afterInsertWait < 1.0)
             {
                 this._afterInsertWait += 0.32f;
             }
             else
             {
                 if ((double)this._gachaWait >= 0.5 && !this.played)
                 {
                     this.played = true;
                     SFX.Play("gachaSound", pitch: Rando.Float(-0.1f, 0.1f));
                 }
                 this._gachaWait += 0.1f;
                 if ((double)this._gachaWait >= 1.0)
                 {
                     this.gachaSpeed += 0.25f;
                     if ((double)this.gachaSpeed > 6.0)
                     {
                         this.gachaSpeed = 6f;
                     }
                     this.gachaY += this.gachaSpeed;
                     if ((double)this.gachaY > 50.0 && (double)this.gachaSpeed > 0.0)
                     {
                         if ((double)this.gachaSpeed > 0.800000011920929)
                         {
                             SFX.Play("gachaBounce", pitch: 0.2f);
                         }
                         this.gachaY     = 50f;
                         this.gachaSpeed = (float)(-(double)this.gachaSpeed * 0.400000005960464);
                     }
                     this._openWait += 0.019f;
                     if ((double)this._openWait >= 1.0)
                     {
                         if (!this.opened)
                         {
                             this.opened = true;
                             SFX.Play("gachaOpen", pitch: Rando.Float(0.1f, 0.3f));
                             this._gachaEgg.frame += 2;
                         }
                         this._swapWait += 0.06f;
                         if ((double)this._swapWait >= 1.0)
                         {
                             if (!this._swapped)
                             {
                                 SFX.Play("harp");
                                 HUD.AddCornerControl(HUDCorner.BottomRight, "@SELECT@CONTINUE");
                                 Profiles.experienceProfile.SetNumFurnitures((int)this._contains.index, Profiles.experienceProfile.GetNumFurnitures((int)this._contains.index) + 1);
                             }
                             this._starGrow += 0.05f;
                             this._swapped   = true;
                         }
                     }
                 }
             }
         }
     }
     this.yOffset = Lerp.FloatSmooth(this.yOffset, this.down ? 150f : 0.0f, 0.4f, 1.1f);
     if (this.down)
     {
         if (this._swapped)
         {
             this.finished = true;
             this.Close();
         }
         else
         {
             this._downWait -= 0.06f;
             if ((double)this._downWait <= 0.0)
             {
                 this._downWait = 1f;
                 this.down      = false;
                 SFX.Play("gachaGet", pitch: -0.4f);
             }
         }
     }
     if (this._swapped && Input.Pressed("SELECT"))
     {
         HUD.CloseAllCorners();
         SFX.Play("resume", 0.6f);
         this.down = true;
     }
     base.UpdateParts();
 }
Exemple #9
0
 public override void Update()
 {
     HUD.CloseCorner(HUDCorner.TopLeft);
     this._dialog.DoUpdate();
     if (this._dialog.opened)
     {
         return;
     }
     Editor.lockInput = (ContextMenu)null;
     if (this._dialog.result != null && this._dialog.result != "")
     {
         string        result        = this._dialog.result;
         LevelPlaylist levelPlaylist = new LevelPlaylist();
         levelPlaylist.levels.AddRange((IEnumerable <string>)Editor.activatedLevels);
         XDocument doc = new XDocument();
         doc.Add((object)levelPlaylist.Serialize());
         DuckFile.SaveXDocument(doc, DuckFile.levelDirectory + result + ".play");
         this.SetCurrentFolder(this._rootDirectory);
         this._dialog.result = (string)null;
     }
     else
     {
         if (this._selectedLevel == null)
         {
             this._exiting = true;
         }
         if (Editor.activatedLevels.Count > 0)
         {
             if (!this.showPlaylistOption)
             {
                 this.showPlaylistOption = true;
                 HUD.AddCornerControl(HUDCorner.BottomLeft, "@RAGDOLL@NEW PLAYLIST");
             }
         }
         else if (this.showPlaylistOption)
         {
             this.showPlaylistOption = false;
             HUD.CloseCorner(HUDCorner.BottomLeft);
         }
         if (this._deleteFile.value)
         {
             foreach (string str in this._selectedLevel.levelsInside)
             {
                 Editor.activatedLevels.Remove(str);
             }
             Editor.activatedLevels.Remove(this._selectedLevel.path);
             if (this._selectedLevel.itemType == LSItemType.Folder)
             {
                 DuckFile.DeleteFolder(DuckFile.levelDirectory + this._selectedLevel.path);
             }
             else if (this._selectedLevel.itemType == LSItemType.Playlist)
             {
                 DuckFile.Delete(DuckFile.levelDirectory + this._selectedLevel.path);
             }
             else
             {
                 DuckFile.Delete(DuckFile.levelDirectory + this._selectedLevel.path + ".lev");
             }
             Thread.Sleep(100);
             this.SetCurrentFolder(this._currentDirectory);
             this._deleteFile.value = false;
         }
         if (this._exiting)
         {
             HUD.CloseAllCorners();
             Graphics.fade = Lerp.Float(Graphics.fade, 0.0f, 0.04f);
             if ((double)Graphics.fade >= 0.00999999977648258)
             {
                 return;
             }
             this.isClosed = true;
         }
         else
         {
             Graphics.fade = Lerp.Float(Graphics.fade, 1f, 0.04f);
             if (Input.Pressed("UP"))
             {
                 if (this._selectedItem > 0)
                 {
                     --this._selectedItem;
                 }
                 if (this._selectedItem < this._topIndex)
                 {
                     this._topIndex = this._selectedItem;
                 }
             }
             else if (Input.Pressed("DOWN"))
             {
                 if (this._selectedItem < this._items.Count <LSItem>() - 1)
                 {
                     ++this._selectedItem;
                 }
                 if (this._selectedItem >= this._topIndex + this._maxItems)
                 {
                     this._topIndex = this._selectedItem + 1 - this._maxItems;
                 }
             }
             else if (Input.Pressed("LEFT"))
             {
                 this._selectedItem -= this._maxItems - 1;
                 if (this._selectedItem < 0)
                 {
                     this._selectedItem = 0;
                 }
                 if (this._selectedItem < this._topIndex)
                 {
                     this._topIndex = this._selectedItem;
                 }
             }
             else if (Input.Pressed("RIGHT"))
             {
                 this._selectedItem += this._maxItems - 1;
                 if (this._selectedItem > this._items.Count <LSItem>() - 1)
                 {
                     this._selectedItem = this._items.Count <LSItem>() - 1;
                 }
                 if (this._selectedItem >= this._topIndex + this._maxItems)
                 {
                     this._topIndex = this._selectedItem + 1 - this._maxItems;
                 }
             }
             else if (Input.Pressed("SHOOT"))
             {
                 if (this._selectedLevel.itemType != LSItemType.UpFolder)
                 {
                     if (this._selectedLevel.itemType == LSItemType.Folder || this._selectedLevel.itemType == LSItemType.Playlist || this._selectedLevel.itemType == LSItemType.Workshop)
                     {
                         if (!this._selectedLevel.enabled)
                         {
                             this._selectedLevel.enabled          = true;
                             this._selectedLevel.partiallyEnabled = false;
                             Editor.activatedLevels.AddRange((IEnumerable <string>) this._selectedLevel.levelsInside);
                         }
                         else
                         {
                             this._selectedLevel.enabled          = false;
                             this._selectedLevel.partiallyEnabled = false;
                             foreach (string str in this._selectedLevel.levelsInside)
                             {
                                 Editor.activatedLevels.Remove(str);
                             }
                         }
                     }
                     else if (Editor.activatedLevels.Contains(this._selectedLevel.path))
                     {
                         Editor.activatedLevels.Remove(this._selectedLevel.path);
                     }
                     else
                     {
                         Editor.activatedLevels.Add(this._selectedLevel.path);
                     }
                 }
             }
             else if (Input.Pressed("SELECT"))
             {
                 if (this._selectedLevel.itemType == LSItemType.Workshop)
                 {
                     this.SetCurrentFolder(this._selectedLevel.path);
                 }
                 else if (this._selectedLevel.itemType == LSItemType.Folder || this._selectedLevel.itemType == LSItemType.Playlist)
                 {
                     this.SetCurrentFolder(this._rootDirectory + this._selectedLevel.path);
                 }
                 else if (this._selectedLevel.itemType == LSItemType.UpFolder)
                 {
                     this.FolderUp();
                 }
             }
             else if (Input.Pressed("QUACK"))
             {
                 if (this._currentDirectory != this._rootDirectory)
                 {
                     this.FolderUp();
                 }
             }
             else if (Input.Pressed("START"))
             {
                 this._exiting = true;
             }
             else if (Input.Pressed("RAGDOLL"))
             {
                 this._dialog.Open("New Playlist...");
                 Editor.lockInput = (ContextMenu)this._dialog;
             }
             else if (Input.Pressed("GRAB") && MonoMain.pauseMenu != this._confirmMenu && (this._selectedLevel.itemType != LSItemType.UpFolder && this._selectedLevel.itemType != LSItemType.Workshop))
             {
                 LevelSelect._skipCompanionOpening = true;
                 MonoMain.pauseMenu = (UIComponent)this._confirmMenu;
                 this._confirmMenu.Open();
                 SFX.Play("pause", 0.6f);
             }
             this.PositionItems();
             if (this._selectedLevel != this._lastSelection)
             {
                 if (this._lastSelection == null || this._selectedLevel.itemType != this._lastSelection.itemType)
                 {
                     HUD.CloseCorner(HUDCorner.BottomRight);
                     if (this._selectedLevel.itemType == LSItemType.UpFolder)
                     {
                         HUD.AddCornerControl(HUDCorner.BottomRight, "@SELECT@Return");
                     }
                     else if (this._selectedLevel.itemType == LSItemType.Folder || this._selectedLevel.itemType == LSItemType.Playlist || this._selectedLevel.itemType == LSItemType.Workshop)
                     {
                         HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@Toggle");
                         HUD.AddCornerControl(HUDCorner.BottomRight, "@SELECT@Open");
                     }
                     else
                     {
                         HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@Toggle");
                     }
                 }
                 this._lastSelection = this._selectedLevel;
             }
             if (this._selectedLevel != this._previewItem)
             {
                 if (this._selectedLevel.itemType == LSItemType.Level)
                 {
                     this._preview       = Content.GeneratePreview(this._selectedLevel.path);
                     this._previewSprite = this._preview == null ? (Sprite)null : new Sprite(this._preview, 0.0f, 0.0f);
                 }
                 else
                 {
                     this._previewSprite = (Sprite)null;
                 }
                 this._previewItem = this._selectedLevel;
             }
             foreach (Thing thing in this._items)
             {
                 thing.Update();
             }
         }
     }
 }
Exemple #10
0
        public override void Update()
        {
            Options.openOnClose = this._pauseMenu;
            if (this.spawnKey)
            {
                if ((double)this.spawnKeyWait > 0.0)
                {
                    this.spawnKeyWait -= Maths.IncFrameTimer();
                }
                else
                {
                    SFX.Play("ching");
                    this.spawnKey = false;
                    Key key = new Key(this._prizeTable.x, this._prizeTable.y);
                    key.vSpeed = -4f;
                    key.depth  = this._duck.depth + 50;
                    Level.Add((Thing)SmallSmoke.New(key.x + Rando.Float(-4f, 4f), key.y + Rando.Float(-4f, 4f)));
                    Level.Add((Thing)SmallSmoke.New(key.x + Rando.Float(-4f, 4f), key.y + Rando.Float(-4f, 4f)));
                    Level.Add((Thing)SmallSmoke.New(key.x + Rando.Float(-4f, 4f), key.y + Rando.Float(-4f, 4f)));
                    Level.Add((Thing)SmallSmoke.New(key.x + Rando.Float(-4f, 4f), key.y + Rando.Float(-4f, 4f)));
                    Level.Add((Thing)key);
                }
            }
            Chancy.Update();
            if (this._pendingSpawns != null && this._pendingSpawns.Count > 0)
            {
                Duck pendingSpawn = this._pendingSpawns[0];
                this.AddThing((Thing)pendingSpawn);
                this._pendingSpawns.RemoveAt(0);
                this._duck   = pendingSpawn;
                this._arcade = this.things[typeof(ArcadeMode)].First <Thing>() as ArcadeMode;
            }
            Layer.Lighting.fade  = Layer.Lighting2.fade = 1f - Math.Min(1f, Math.Max(0.0f, (float)((1.0 - (double)Layer.Game.fade) * 1.5)));
            this.backgroundColor = Color.Black;
            if (UnlockScreen.open || ArcadeHUD.open)
            {
                foreach (Thing challenge in this._challenges)
                {
                    challenge.visible = false;
                }
                this._prizeTable.visible = false;
            }
            else
            {
                foreach (Thing challenge in this._challenges)
                {
                    challenge.visible = true;
                }
                this._prizeTable.visible = true;
            }
            if (this._state == this._desiredState && this._state != ArcadeState.UnlockMachine && this._state != ArcadeState.LaunchChallenge)
            {
                if (!this._quitting)
                {
                    if (Input.Pressed("START"))
                    {
                        this._pauseGroup.Open();
                        this._pauseMenu.Open();
                        MonoMain.pauseMenu = this._pauseGroup;
                        if (!this._paused)
                        {
                            Music.Pause();
                            SFX.Play("pause", 0.6f);
                            this._paused           = true;
                            this._duck.immobilized = true;
                        }
                        this.simulatePhysics = false;
                        return;
                    }
                    if (this._paused && MonoMain.pauseMenu == null)
                    {
                        this._paused = false;
                        SFX.Play("resume", 0.6f);
                        if (this._quit.value)
                        {
                            this._quitting = true;
                        }
                        else
                        {
                            Music.Resume();
                            this._duck.immobilized = false;
                            this.simulatePhysics   = true;
                        }
                    }
                }
                else
                {
                    Graphics.fade = Lerp.Float(Graphics.fade, 0.0f, 0.02f);
                    if ((double)Graphics.fade > 0.00999999977648258)
                    {
                        return;
                    }
                    Level.current = (Level) new TitleScreen();
                    return;
                }
            }
            if (this._paused)
            {
                return;
            }
            if (this._hud.launchChallenge)
            {
                this._desiredState = ArcadeState.LaunchChallenge;
            }
            if (this._desiredState != this._state)
            {
                this._duck.active = false;
                bool flag = false;
                if (this._desiredState == ArcadeState.ViewChallenge)
                {
                    this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 0.0f, 0.1f);
                    this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, 2f, 0.16f);
                    if ((double)this._followCam.manualViewSize < 30.0)
                    {
                        Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                        Layer.Background.fade = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                        this._hud.alpha       = Lerp.Float(this._hud.alpha, 1f, 0.08f);
                        if ((double)this._followCam.manualViewSize < 3.0 && (double)this._hud.alpha == 1.0 && (double)Layer.Game.fade == 0.0)
                        {
                            flag = true;
                        }
                    }
                }
                else if (this._desiredState == ArcadeState.Normal)
                {
                    if (!this._flipState)
                    {
                        this._followCam.Clear();
                        this._followCam.Add((Thing)this._duck);
                        HUD.CloseAllCorners();
                    }
                    this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 1f, 0.1f, 1.1f);
                    if (this._state == ArcadeState.ViewChallenge || this._state == ArcadeState.UnlockScreen)
                    {
                        this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, this._followCam.viewSize, 0.14f, 1.05f);
                    }
                    Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
                    this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
                    if (((double)this._followCam.manualViewSize < 0.0 || (double)this._followCam.manualViewSize == (double)this._followCam.viewSize) && ((double)this._hud.alpha == 0.0 && (double)Layer.Game.fade == 1.0))
                    {
                        flag = true;
                        this._followCam.manualViewSize = -1f;
                        this._duck.alpha = 1f;
                    }
                    if (Unlockables.HasPendingUnlocks())
                    {
                        MonoMain.pauseMenu = (UIComponent) new UIUnlockBox(Unlockables.GetPendingUnlocks().ToList <Unlockable>(), Layer.HUD.camera.width / 2f, Layer.HUD.camera.height / 2f, 190f);
                    }
                }
                else if (this._desiredState == ArcadeState.ViewSpecialChallenge || this._desiredState == ArcadeState.ViewChallengeList || this._desiredState == ArcadeState.ViewProfileSelector)
                {
                    if (!this._flipState)
                    {
                        this._followCam.Clear();
                        this._followCam.Add((Thing)this._duck);
                        HUD.CloseAllCorners();
                    }
                    this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 1f, 0.1f, 1.1f);
                    if (this._state == ArcadeState.ViewChallenge || this._state == ArcadeState.UnlockScreen)
                    {
                        this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, this._followCam.viewSize, 0.14f, 1.05f);
                    }
                    Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
                    this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
                    if (((double)this._followCam.manualViewSize < 0.0 || (double)this._followCam.manualViewSize == (double)this._followCam.viewSize) && ((double)this._hud.alpha == 0.0 && (double)Layer.Game.fade == 1.0))
                    {
                        flag = true;
                        this._followCam.manualViewSize = -1f;
                        this._duck.alpha = 1f;
                    }
                }
                else if (this._desiredState == ArcadeState.UnlockMachine)
                {
                    if (!this._flipState)
                    {
                        this._followCam.Clear();
                        this._followCam.Add((Thing)this._unlockMachines[0]);
                        HUD.CloseAllCorners();
                    }
                    if (this._state == ArcadeState.ViewChallenge)
                    {
                        this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, this._followCam.viewSize, 0.14f, 1.05f);
                    }
                    this._duck.alpha         = Lerp.FloatSmooth(this._duck.alpha, 1f, 0.1f, 1.1f);
                    Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
                    this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
                    this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
                    this._unlockMachineWait  = 1f;
                    if (((double)this._followCam.manualViewSize < 0.0 || (double)this._followCam.manualViewSize == (double)this._followCam.viewSize) && ((double)this._hud.alpha == 0.0 && (double)Layer.Game.fade == 1.0))
                    {
                        flag = true;
                        this._followCam.manualViewSize = -1f;
                        this._duck.alpha = 1f;
                    }
                }
                else if (this._desiredState == ArcadeState.LaunchChallenge)
                {
                    if (!this._flipState)
                    {
                        HUD.CloseAllCorners();
                    }
                    Music.volume             = Lerp.Float(Music.volume, 0.0f, 0.01f);
                    this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.02f);
                    this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
                    if ((double)this._hud.alpha == 0.0)
                    {
                        flag = true;
                    }
                }
                if (this._desiredState == ArcadeState.UnlockScreen)
                {
                    this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 0.0f, 0.1f);
                    this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, 2f, 0.16f);
                    if ((double)this._followCam.manualViewSize < 30.0)
                    {
                        Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                        Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                        this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 1f, 0.08f);
                        if ((double)this._followCam.manualViewSize < 3.0 && (double)this._unlockScreen.alpha == 1.0 && (double)Layer.Game.fade == 0.0)
                        {
                            flag = true;
                        }
                    }
                }
                this._flipState = true;
                if (this._launchedChallenge)
                {
                    Layer.Background.fade = 0.0f;
                    Layer.Game.fade       = 0.0f;
                }
                if (!flag)
                {
                    return;
                }
                this._flipState = false;
                HUD.CloseAllCorners();
                this._state = this._desiredState;
                if (this._state == ArcadeState.ViewChallenge)
                {
                    if (this._afterChallenge)
                    {
                        Music.Play("Arcade");
                        this._afterChallenge = false;
                    }
                    this._hud.MakeActive();
                    Level.Add((Thing)this._hud);
                    this._duck.active = false;
                }
                else if (this._state == ArcadeState.LaunchChallenge)
                {
                    ArcadeLevel.currentArcade = this;
                    foreach (Thing thing in this.things[typeof(ChallengeConfetti)])
                    {
                        Level.Remove(thing);
                    }
                    Music.Stop();
                    Level.current = (Level) new ChallengeLevel(this._hud.selected.challenge.fileName);
                    if (!this.launchSpecialChallenge)
                    {
                        this._desiredState        = ArcadeState.ViewChallenge;
                        this._hud.launchChallenge = false;
                        this._launchedChallenge   = false;
                        this._afterChallenge      = true;
                    }
                    else
                    {
                        this._desiredState          = ArcadeState.ViewSpecialChallenge;
                        this._hud.launchChallenge   = false;
                        this._launchedChallenge     = false;
                        this._afterChallenge        = true;
                        this.launchSpecialChallenge = false;
                    }
                }
                else
                {
                    if (this._state == ArcadeState.UnlockMachine)
                    {
                        return;
                    }
                    if (this._state == ArcadeState.Normal)
                    {
                        this._unlockMachines.Clear();
                        foreach (ArcadeMachine challenge in this._challenges)
                        {
                            if (challenge.CheckUnlocked())
                            {
                                this._unlockMachines.Add(challenge);
                            }
                        }
                        if (this._unlockMachines.Count > 0)
                        {
                            this._desiredState = ArcadeState.UnlockMachine;
                        }
                        else
                        {
                            if (!this.basementWasUnlocked && Unlocks.IsUnlocked("BASEMENTKEY", Profiles.active[0]))
                            {
                                this.spawnKey            = true;
                                this.basementWasUnlocked = true;
                            }
                            this._duck.active = true;
                        }
                    }
                    else if (this._state == ArcadeState.ViewSpecialChallenge)
                    {
                        this._duck.active = false;
                        if (this._afterChallenge)
                        {
                            Music.Play("Arcade");
                            this._afterChallenge = false;
                            HUD.AddCornerCounter(HUDCorner.TopLeft, "@TICKET@ ", new FieldBinding((object)Profiles.active[0], "ticketCount"), animateCount: true);
                            Chancy.afterChallenge     = true;
                            Chancy.afterChallengeWait = 1f;
                        }
                        else
                        {
                            HUD.AddCornerControl(HUDCorner.BottomLeft, "ACCEPT@SELECT@");
                            HUD.AddCornerControl(HUDCorner.BottomRight, "@QUACK@CANCEL");
                            HUD.AddCornerCounter(HUDCorner.TopLeft, "@TICKET@ ", new FieldBinding((object)Profiles.active[0], "ticketCount"), animateCount: true);
                        }
                        this._duck.active = false;
                    }
                    else if (this._state == ArcadeState.ViewProfileSelector)
                    {
                        this._duck.active = false;
                        ArcadeHatConsole arcadeHatConsole = (ArcadeHatConsole)Level.First <ArcadeHatConsole>();
                        if (arcadeHatConsole == null)
                        {
                            return;
                        }
                        HUD.CloseAllCorners();
                        arcadeHatConsole.Open();
                    }
                    else if (this._state == ArcadeState.ViewChallengeList)
                    {
                        this._duck.active = false;
                        HUD.AddCornerControl(HUDCorner.BottomLeft, "ACCEPT@SELECT@");
                        HUD.AddCornerControl(HUDCorner.BottomRight, "@QUACK@BACK");
                    }
                    else
                    {
                        if (this._state != ArcadeState.UnlockScreen)
                        {
                            return;
                        }
                        this.basementWasUnlocked = Unlocks.IsUnlocked("BASEMENTKEY", Profiles.active[0]);
                        this._unlockScreen.MakeActive();
                        this._duck.active = false;
                    }
                }
            }
            else if (this._state == ArcadeState.Normal || this._state == ArcadeState.UnlockMachine)
            {
                Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 1f, 0.08f);
                Layer.Background.fade = Lerp.Float(Layer.Game.fade, 1f, 0.08f);
                this._hud.alpha       = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
                if (this._state == ArcadeState.Normal)
                {
                    object obj = (object)null;
                    foreach (ArcadeMachine challenge in this._challenges)
                    {
                        double length = (double)(this._duck.position - challenge.position).length;
                        if (challenge.hover)
                        {
                            obj = (object)challenge;
                            if (Input.Pressed("SHOOT"))
                            {
                                this._hud.activeChallengeGroup = challenge.data;
                                this._desiredState             = ArcadeState.ViewChallenge;
                                this._followCam.manualViewSize = this._followCam.viewSize;
                                this._followCam.Clear();
                                this._followCam.Add((Thing)challenge);
                                HUD.CloseAllCorners();
                                this._hoverMachine = (ArcadeMachine)null;
                                this._hoverThing   = (object)null;
                                return;
                            }
                        }
                        if (this._prizeTable.hover)
                        {
                            obj = (object)this._prizeTable;
                            if (Input.Pressed("SHOOT"))
                            {
                                this._desiredState             = ArcadeState.UnlockScreen;
                                this._followCam.manualViewSize = this._followCam.viewSize;
                                this._followCam.Clear();
                                this._followCam.Add((Thing)this._prizeTable);
                                HUD.CloseAllCorners();
                                this._hoverMachine = (ArcadeMachine)null;
                                this._hoverThing   = (object)null;
                                return;
                            }
                        }
                    }
                    if (Chancy.hover && Input.Pressed("SHOOT"))
                    {
                        this._desiredState = ArcadeState.ViewSpecialChallenge;
                        HUD.CloseAllCorners();
                        this._hoverMachine        = (ArcadeMachine)null;
                        this._hoverThing          = (object)null;
                        Chancy.hover              = false;
                        Chancy.lookingAtChallenge = true;
                        Chancy.OpenChallengeView();
                    }
                    else
                    {
                        ArcadeHatConsole arcadeHatConsole = (ArcadeHatConsole)Level.First <ArcadeHatConsole>();
                        if (arcadeHatConsole != null && Input.Pressed("SHOOT") && arcadeHatConsole.hover)
                        {
                            this._desiredState = ArcadeState.ViewProfileSelector;
                            HUD.CloseAllCorners();
                            this._hoverMachine = (ArcadeMachine)null;
                            this._hoverThing   = (object)null;
                        }
                        else
                        {
                            Chancy.hover = false;
                            if (!Chancy.atCounter)
                            {
                                if ((double)(this._duck.position - Chancy.standingPosition).length < 22.0)
                                {
                                    obj          = (object)Chancy.context;
                                    Chancy.hover = true;
                                }
                                if ((double)Chancy.standingPosition.x < (double)Layer.Game.camera.left - 16.0 || (double)Chancy.standingPosition.x > (double)Layer.Game.camera.right + 16.0 || ((double)Chancy.standingPosition.y < (double)Layer.Game.camera.top - 16.0 || (double)Chancy.standingPosition.y > (double)Layer.Game.camera.bottom + 16.0))
                                {
                                    Chancy.atCounter       = true;
                                    Chancy.activeChallenge = (ChallengeData)null;
                                }
                            }
                            else if (this._prizeTable.hoverChancyChallenge)
                            {
                                obj = (object)this._arcade;
                                if (Input.Pressed("SHOOT"))
                                {
                                    this._desiredState = ArcadeState.ViewChallengeList;
                                    HUD.CloseAllCorners();
                                    Chancy.OpenChallengeList();
                                    this._hoverMachine   = (ArcadeMachine)null;
                                    this._hoverThing     = (object)null;
                                    Chancy.hover         = false;
                                    Chancy.lookingAtList = true;
                                    return;
                                }
                            }
                            if (this._hoverThing == obj)
                            {
                                return;
                            }
                            HUD.CloseAllCorners();
                            this._hoverThing   = obj;
                            this._hoverMachine = !(this._hoverThing is ArcadeMachine) ? (ArcadeMachine)null : obj as ArcadeMachine;
                            if (this._hoverMachine != null)
                            {
                                HUD.AddCornerControl(HUDCorner.BottomLeft, "PLAY@SHOOT@");
                                string text = this._hoverMachine.data.name + " ";
                                foreach (string challenge1 in this._hoverMachine.data.challenges)
                                {
                                    ChallengeData challenge2 = Challenges.GetChallenge(challenge1);
                                    if (challenge2 != null)
                                    {
                                        ChallengeSaveData saveData = Challenges.GetSaveData(challenge2.levelID, this._duck.profile);
                                        if (saveData.trophy == TrophyType.Baseline)
                                        {
                                            text += "@BASELINE@";
                                        }
                                        else if (saveData.trophy == TrophyType.Bronze)
                                        {
                                            text += "@BRONZE@";
                                        }
                                        else if (saveData.trophy == TrophyType.Silver)
                                        {
                                            text += "@SILVER@";
                                        }
                                        else if (saveData.trophy == TrophyType.Gold)
                                        {
                                            text += "@GOLD@";
                                        }
                                        else if (saveData.trophy == TrophyType.Platinum)
                                        {
                                            text += "@PLATINUM@";
                                        }
                                        else if (saveData.trophy == TrophyType.Developer)
                                        {
                                            text += "@DEVELOPER@";
                                        }
                                    }
                                }
                                HUD.AddCornerMessage(HUDCorner.TopLeft, text);
                            }
                            else if (this._prizeTable.hover)
                            {
                                if (this._prizeTable.hoverChancyChallenge)
                                {
                                    HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@VIEW CHALLENGES");
                                }
                                else
                                {
                                    HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@SPEND TICKETS");
                                    HUD.AddCornerCounter(HUDCorner.BottomLeft, "@TICKET@ ", new FieldBinding((object)Profiles.active[0], "ticketCount"), animateCount: true);
                                }
                            }
                            else
                            {
                                switch (obj)
                                {
                                case ArcadeMode _:
                                    if (!this._prizeTable.hoverChancyChallenge)
                                    {
                                        break;
                                    }
                                    HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@VIEW CHALLENGES");
                                    break;

                                case Chancy _:
                                    HUD.AddCornerControl(HUDCorner.BottomLeft, "CHANCY@SHOOT@");
                                    break;
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (this._state != ArcadeState.UnlockMachine)
                    {
                        return;
                    }
                    this._unlockMachineWait   -= 0.02f;
                    Layer.Lighting2.targetFade = Lerp.Float(Layer.Lighting2.targetFade, 0.5f, 0.01f);
                    if ((double)this._unlockMachineWait >= 0.0)
                    {
                        return;
                    }
                    if (this._unlockingMachine)
                    {
                        this._unlockingMachine = false;
                        this._followCam.Clear();
                        this._followCam.Add((Thing)this._unlockMachines[0]);
                        this._unlockMachineWait = 1f;
                    }
                    else if (this._unlockMachines.Count > 0)
                    {
                        this._unlockMachines[0].unlocked = true;
                        this._unlockMachines.RemoveAt(0);
                        this._unlockingMachine = this._unlockMachines.Count > 0;
                        SFX.Play("lightTurnOn", pitch: Rando.Float(-0.1f, 0.1f));
                        this._unlockMachineWait    = 1f;
                        Layer.Lighting2.targetFade = 1f;
                    }
                    else
                    {
                        this._desiredState = ArcadeState.Normal;
                    }
                }
            }
            else if (this._state == ArcadeState.ViewChallenge)
            {
                Graphics.fade         = Lerp.Float(Graphics.fade, 1f, 0.05f);
                Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 0.0f, 0.05f);
                Layer.Background.fade = Lerp.Float(Layer.Game.fade, 0.0f, 0.05f);
                this._hud.alpha       = Lerp.Float(this._hud.alpha, 1f, 0.05f);
                if (!this._hud.quitOut)
                {
                    return;
                }
                this._hud.quitOut  = false;
                this._desiredState = ArcadeState.Normal;
                if (Chancy.activeChallenge != null)
                {
                    return;
                }
                List <ChallengeData> chancyChallenges = Challenges.GetEligibleIncompleteChancyChallenges(Profiles.active[0]);
                if (chancyChallenges.Count <= 0)
                {
                    return;
                }
                Vec2          position      = this._duck.position;
                ArcadeMachine arcadeMachine = Level.Nearest <ArcadeMachine>(this._duck.x, this._duck.y);
                if (arcadeMachine != null)
                {
                    position = arcadeMachine.position;
                }
                chancyChallenges.OrderBy <ChallengeData, int>((Func <ChallengeData, int>)(v => v.GetRequirementValue()));
                Chancy.AddProposition(chancyChallenges[chancyChallenges.Count - 1], position);
            }
            else if (this._state == ArcadeState.UnlockScreen)
            {
                if (!this._unlockScreen.quitOut)
                {
                    return;
                }
                this._unlockScreen.quitOut = false;
                this._desiredState         = ArcadeState.Normal;
            }
            else if (this._state == ArcadeState.ViewSpecialChallenge)
            {
                if (!this.launchSpecialChallenge)
                {
                    Graphics.fade = Lerp.Float(Graphics.fade, 1f, 0.05f);
                    if (Input.Pressed("QUACK"))
                    {
                        if (this.returnToChallengeList)
                        {
                            this._desiredState   = ArcadeState.ViewChallengeList;
                            Chancy.hover         = false;
                            Chancy.lookingAtList = true;
                        }
                        else
                        {
                            this._desiredState = ArcadeState.Normal;
                        }
                        Chancy.lookingAtChallenge = false;
                        HUD.CloseAllCorners();
                        SFX.Play("consoleCancel");
                    }
                    else
                    {
                        if (!Input.Pressed("SELECT"))
                        {
                            return;
                        }
                        this.launchSpecialChallenge = true;
                        SFX.Play("consoleSelect");
                    }
                }
                else
                {
                    Graphics.fade = Lerp.Float(Graphics.fade, 0.0f, 0.05f);
                    if ((double)Graphics.fade >= 0.00999999977648258)
                    {
                        return;
                    }
                    this._hud.launchChallenge = true;
                    this._hud.selected        = new ChallengeCard(0.0f, 0.0f, Chancy.activeChallenge);
                    HUD.CloseAllCorners();
                }
            }
            else if (this._state == ArcadeState.ViewChallengeList)
            {
                Graphics.fade = Lerp.Float(Graphics.fade, 1f, 0.05f);
                if (Input.Pressed("QUACK"))
                {
                    this._desiredState        = ArcadeState.Normal;
                    Chancy.lookingAtChallenge = false;
                    Chancy.lookingAtList      = false;
                    HUD.CloseAllCorners();
                    SFX.Play("consoleCancel");
                }
                else
                {
                    if (!Input.Pressed("SELECT"))
                    {
                        return;
                    }
                    Chancy.AddProposition(Chancy.selectedChallenge, Chancy.standingPosition);
                    this.returnToChallengeList = true;
                    this._desiredState         = ArcadeState.ViewSpecialChallenge;
                    HUD.CloseAllCorners();
                    this._hoverMachine        = (ArcadeMachine)null;
                    this._hoverThing          = (object)null;
                    Chancy.hover              = false;
                    Chancy.lookingAtChallenge = true;
                    Chancy.lookingAtList      = false;
                    Chancy.OpenChallengeView();
                }
            }
            else
            {
                if (this._state != ArcadeState.ViewProfileSelector)
                {
                    return;
                }
                Graphics.fade = Lerp.Float(Graphics.fade, 1f, 0.05f);
                ArcadeHatConsole arcadeHatConsole = (ArcadeHatConsole)Level.First <ArcadeHatConsole>();
                if (arcadeHatConsole == null || arcadeHatConsole.IsOpen())
                {
                    return;
                }
                foreach (ArcadeMachine challenge in this._challenges)
                {
                    challenge.unlocked = challenge.CheckUnlocked(false);
                }
                this._unlockMachines.Clear();
                this.UpdateDefault();
                this._desiredState = ArcadeState.Normal;
            }
        }
Exemple #11
0
 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 Update()
 {
     this.backgroundColor = Color.Black;
     if (UnlockScreen.open || ArcadeHUD.open)
     {
         this._background.visible = false;
         foreach (Thing challenge in this._challenges)
         {
             challenge.visible = false;
         }
         this._prizeTable.visible = false;
     }
     else
     {
         this._background.visible = true;
         foreach (Thing challenge in this._challenges)
         {
             challenge.visible = true;
         }
         this._prizeTable.visible = true;
     }
     if (this._state == this._desiredState && this._state != ArcadeState.UnlockMachine && this._state != ArcadeState.LaunchChallenge)
     {
         if (!this._quitting)
         {
             if (Input.Pressed("START"))
             {
                 this._pauseGroup.Open();
                 this._pauseMenu.Open();
                 MonoMain.pauseMenu = this._pauseGroup;
                 if (!this._paused)
                 {
                     Music.Pause();
                     SFX.Play("pause", 0.6f);
                     this._paused           = true;
                     this._duck.immobilized = true;
                 }
                 this.simulatePhysics = false;
                 return;
             }
             if (this._paused && MonoMain.pauseMenu == null)
             {
                 this._paused = false;
                 SFX.Play("resume", 0.6f);
                 if (this._quit.value)
                 {
                     this._quitting = true;
                 }
                 else
                 {
                     Music.Resume();
                     this._duck.immobilized = false;
                     this.simulatePhysics   = true;
                 }
             }
         }
         else
         {
             Graphics.fade = Lerp.Float(Graphics.fade, 0.0f, 0.02f);
             if ((double)Graphics.fade <= 0.00999999977648258)
             {
                 Level.current = (Level) new TitleScreen();
             }
         }
     }
     if (this._paused)
     {
         return;
     }
     this._hud.Update();
     if (this._hud.launchChallenge)
     {
         this._desiredState = ArcadeState.LaunchChallenge;
     }
     if (this._desiredState != this._state)
     {
         this._duck.active = false;
         bool flag = false;
         if (this._desiredState == ArcadeState.ViewChallenge)
         {
             this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 0.0f, 0.1f);
             this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, 2f, 0.16f);
             if ((double)this._followCam.manualViewSize < 30.0)
             {
                 Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                 Layer.Background.fade = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                 this._hud.alpha       = Lerp.Float(this._hud.alpha, 1f, 0.08f);
                 if ((double)this._followCam.manualViewSize < 3.0 && (double)this._hud.alpha == 1.0 && (double)Layer.Game.fade == 0.0)
                 {
                     flag = true;
                 }
             }
         }
         else if (this._desiredState == ArcadeState.Normal)
         {
             if (!this._flipState)
             {
                 this._followCam.Clear();
                 this._followCam.Add((Thing)this._duck);
                 HUD.CloseAllCorners();
             }
             this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 1f, 0.1f, 1.1f);
             if (this._state == ArcadeState.ViewChallenge || this._state == ArcadeState.UnlockScreen)
             {
                 this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, this._followCam.viewSize, 0.14f, 1.05f);
             }
             Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
             Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
             this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
             this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
             if (((double)this._followCam.manualViewSize < 0.0 || (double)this._followCam.manualViewSize == (double)this._followCam.viewSize) && ((double)this._hud.alpha == 0.0 && (double)Layer.Game.fade == 1.0))
             {
                 flag = true;
                 this._followCam.manualViewSize = -1f;
                 this._duck.alpha = 1f;
             }
         }
         else if (this._desiredState == ArcadeState.UnlockMachine)
         {
             if (!this._flipState)
             {
                 this._followCam.Clear();
                 this._followCam.Add((Thing)this._unlockMachines[0]);
                 HUD.CloseAllCorners();
             }
             if (this._state == ArcadeState.ViewChallenge)
             {
                 this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, this._followCam.viewSize, 0.14f, 1.05f);
             }
             this._duck.alpha         = Lerp.FloatSmooth(this._duck.alpha, 1f, 0.1f, 1.1f);
             Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
             Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 1f, 0.05f);
             this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
             this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
             this._unlockMachineWait  = 1f;
             if (((double)this._followCam.manualViewSize < 0.0 || (double)this._followCam.manualViewSize == (double)this._followCam.viewSize) && ((double)this._hud.alpha == 0.0 && (double)Layer.Game.fade == 1.0))
             {
                 flag = true;
                 this._followCam.manualViewSize = -1f;
                 this._duck.alpha = 1f;
             }
         }
         else if (this._desiredState == ArcadeState.LaunchChallenge)
         {
             if (!this._flipState)
             {
                 HUD.CloseAllCorners();
             }
             Music.volume             = Lerp.Float(Music.volume, 0.0f, 0.01f);
             this._hud.alpha          = Lerp.Float(this._hud.alpha, 0.0f, 0.02f);
             this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 0.0f, 0.08f);
             if ((double)this._hud.alpha == 0.0)
             {
                 flag = true;
             }
         }
         if (this._desiredState == ArcadeState.UnlockScreen)
         {
             this._duck.alpha = Lerp.FloatSmooth(this._duck.alpha, 0.0f, 0.1f);
             this._followCam.manualViewSize = Lerp.FloatSmooth(this._followCam.manualViewSize, 2f, 0.16f);
             if ((double)this._followCam.manualViewSize < 30.0)
             {
                 Layer.Game.fade          = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                 Layer.Background.fade    = Lerp.Float(Layer.Game.fade, 0.0f, 0.08f);
                 this._unlockScreen.alpha = Lerp.Float(this._unlockScreen.alpha, 1f, 0.08f);
                 if ((double)this._followCam.manualViewSize < 3.0 && (double)this._unlockScreen.alpha == 1.0 && (double)Layer.Game.fade == 0.0)
                 {
                     flag = true;
                 }
             }
         }
         this._flipState = true;
         if (this._launchedChallenge)
         {
             Layer.Background.fade = 0.0f;
             Layer.Game.fade       = 0.0f;
         }
         if (!flag)
         {
             return;
         }
         this._flipState = false;
         HUD.CloseAllCorners();
         this._state = this._desiredState;
         if (this._state == ArcadeState.ViewChallenge)
         {
             if (this._afterChallenge)
             {
                 Music.Play(nameof(Arcade));
                 this._afterChallenge = false;
             }
             this._hud.MakeActive();
             this._duck.active = false;
         }
         else if (this._state == ArcadeState.LaunchChallenge)
         {
             Arcade.currentArcade = this;
             foreach (Thing thing in this.things[typeof(ChallengeConfetti)])
             {
                 Level.Remove(thing);
             }
             Music.Stop();
             Level.current             = (Level) new ChallengeLevel(this._hud.selected.challenge.fileName);
             this._desiredState        = ArcadeState.ViewChallenge;
             this._hud.launchChallenge = false;
             this._launchedChallenge   = false;
             this._afterChallenge      = true;
         }
         else
         {
             if (this._state == ArcadeState.UnlockMachine)
             {
                 return;
             }
             if (this._state == ArcadeState.Normal)
             {
                 this._unlockMachines.Clear();
                 foreach (ArcadeMachine challenge in this._challenges)
                 {
                     if (challenge.CheckUnlocked())
                     {
                         this._unlockMachines.Add(challenge);
                     }
                 }
                 if (this._unlockMachines.Count > 0)
                 {
                     this._desiredState = ArcadeState.UnlockMachine;
                 }
                 else
                 {
                     this._duck.active = true;
                 }
             }
             else if (this._state == ArcadeState.UnlockScreen)
             {
                 this._unlockScreen.MakeActive();
                 this._duck.active = false;
             }
             else
             {
                 if (this._state != ArcadeState.ViewSpecialChallenge)
                 {
                     return;
                 }
                 if (this._afterChallenge)
                 {
                     Music.Play(nameof(Arcade));
                     this._afterChallenge = false;
                 }
                 Chancy.afterChallenge     = true;
                 Chancy.afterChallengeWait = 1f;
                 this._duck.active         = false;
             }
         }
     }
     else if (this._state == ArcadeState.Normal || this._state == ArcadeState.UnlockMachine)
     {
         Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 1f, 0.08f);
         Layer.Background.fade = Lerp.Float(Layer.Game.fade, 1f, 0.08f);
         this._hud.alpha       = Lerp.Float(this._hud.alpha, 0.0f, 0.08f);
         if (this._state == ArcadeState.Normal)
         {
             object obj = (object)null;
             foreach (ArcadeMachine challenge in this._challenges)
             {
                 double length = (double)(this._duck.position - challenge.position).length;
                 if (challenge.hover)
                 {
                     obj = (object)challenge;
                     if (Input.Pressed("SHOOT"))
                     {
                         this._hud.activeChallengeGroup = challenge.data;
                         this._desiredState             = ArcadeState.ViewChallenge;
                         this._followCam.manualViewSize = this._followCam.viewSize;
                         this._followCam.Clear();
                         this._followCam.Add((Thing)challenge);
                         HUD.CloseAllCorners();
                         this._hoverMachine = (ArcadeMachine)null;
                         this._hoverThing   = (object)null;
                         return;
                     }
                 }
                 if (this._prizeTable.hover)
                 {
                     obj = (object)this._prizeTable;
                     if (Input.Pressed("SHOOT"))
                     {
                         this._desiredState             = ArcadeState.UnlockScreen;
                         this._followCam.manualViewSize = this._followCam.viewSize;
                         this._followCam.Clear();
                         this._followCam.Add((Thing)this._prizeTable);
                         HUD.CloseAllCorners();
                         this._hoverMachine = (ArcadeMachine)null;
                         this._hoverThing   = (object)null;
                         return;
                     }
                 }
             }
             if (this._hoverThing == obj)
             {
                 return;
             }
             HUD.CloseAllCorners();
             this._hoverThing   = obj;
             this._hoverMachine = !(this._hoverThing is ArcadeMachine) ? (ArcadeMachine)null : obj as ArcadeMachine;
             if (this._hoverMachine != null)
             {
                 HUD.AddCornerControl(HUDCorner.BottomLeft, "PLAY@SHOOT@", this._duck.inputProfile);
                 string text = this._hoverMachine.data.name + " ";
                 foreach (string challenge in this._hoverMachine.data.challenges)
                 {
                     ChallengeSaveData saveData = Challenges.GetSaveData(Challenges.GetChallenge(challenge).levelID, this._duck.profile);
                     if (saveData.trophy == TrophyType.Baseline)
                     {
                         text += "@BASELINE@";
                     }
                     else if (saveData.trophy == TrophyType.Bronze)
                     {
                         text += "@BRONZE@";
                     }
                     else if (saveData.trophy == TrophyType.Silver)
                     {
                         text += "@SILVER@";
                     }
                     else if (saveData.trophy == TrophyType.Gold)
                     {
                         text += "@GOLD@";
                     }
                     else if (saveData.trophy == TrophyType.Platinum)
                     {
                         text += "@PLATINUM@";
                     }
                     else if (saveData.trophy == TrophyType.Developer)
                     {
                         text += "@DEVELOPER@";
                     }
                 }
                 HUD.AddCornerMessage(HUDCorner.TopLeft, text);
             }
             else
             {
                 if (!this._prizeTable.hover)
                 {
                     return;
                 }
                 HUD.AddCornerControl(HUDCorner.BottomRight, "@SHOOT@SPEND TICKETS", this._duck.inputProfile);
                 HUD.AddCornerCounter(HUDCorner.BottomLeft, "@TICKET@ ", new FieldBinding((object)Profiles.active[0], "ticketCount"), animateCount: true);
             }
         }
         else
         {
             if (this._state != ArcadeState.UnlockMachine)
             {
                 return;
             }
             this._unlockMachineWait -= 0.02f;
             if ((double)this._unlockMachineWait >= 0.0)
             {
                 return;
             }
             if (this._unlockingMachine)
             {
                 this._unlockingMachine = false;
                 this._followCam.Clear();
                 this._followCam.Add((Thing)this._unlockMachines[0]);
                 this._unlockMachineWait = 1f;
             }
             else if (this._unlockMachines.Count > 0)
             {
                 this._unlockMachines[0].unlocked = true;
                 this._unlockMachines.RemoveAt(0);
                 this._unlockingMachine = this._unlockMachines.Count > 0;
                 SFX.Play("lightTurnOn", pitch: Rando.Float(-0.1f, 0.1f));
                 this._unlockMachineWait = 1f;
             }
             else
             {
                 this._desiredState = ArcadeState.Normal;
             }
         }
     }
     else if (this._state == ArcadeState.ViewChallenge)
     {
         Layer.Game.fade       = Lerp.Float(Layer.Game.fade, 0.0f, 0.05f);
         Layer.Background.fade = Lerp.Float(Layer.Game.fade, 0.0f, 0.05f);
         this._hud.alpha       = Lerp.Float(this._hud.alpha, 1f, 0.05f);
         if (!this._hud.quitOut)
         {
             return;
         }
         this._hud.quitOut  = false;
         this._desiredState = ArcadeState.Normal;
     }
     else
     {
         if (this._state != ArcadeState.UnlockScreen || !this._unlockScreen.quitOut)
         {
             return;
         }
         this._unlockScreen.quitOut = false;
         this._desiredState         = ArcadeState.Normal;
     }
 }
 public override void Update()
 {
     if (this._testMode)
     {
         this._wait += Maths.IncFrameTimer();
         if (Keyboard.Pressed(Keys.F5) || (double)this._wait > 0.1)
         {
             this._wait = 0.0f;
             try
             {
                 this._tie        = new SpriteMap((Tex2D)ContentPack.LoadTexture2D("tieTest.png"), 64, 64);
                 this._tie.center = new Vec2(26f, 27f);
             }
             catch (Exception ex)
             {
             }
         }
     }
     DuckGame.Graphics.fadeAdd = Lerp.Float(DuckGame.Graphics.fadeAdd, 0.0f, 0.01f);
     if (Main.isDemo && this._skip && !this._firedSkipLogic)
     {
         this._firedSkipLogic = true;
         Vote.CloseVoting();
         HUD.CloseAllCorners();
         this.DoSkip();
     }
     if ((double)DuckGame.Graphics.fade > 0.990000009536743 && !this._skip && Vote.Passed(VoteType.Skip))
     {
         this._skip = true;
     }
     if (this._talker.finished || !HighlightLevel._cancelSkip && this._skip && !Main.isDemo)
     {
         this._done -= 0.04f;
     }
     DuckGame.Graphics.fade = Lerp.Float(DuckGame.Graphics.fade, (double)this._done < 0.0 ? 0.0f : 1f, 0.02f);
     if ((double)DuckGame.Graphics.fade < 0.00999999977648258 && (this._talker.finished || this._skip))
     {
         if (this._endOfHighlights || this._skip)
         {
             Vote.CloseVoting();
             Level.current = (Level) new RockScoreboard(RockScoreboard.returnLevel, ScoreBoardMode.ShowWinner, true);
         }
         else
         {
             Level.current = (Level) new HighlightPlayback(4);
         }
     }
     if (this._state == TVState.ShowPedestals)
     {
         this._waitZoom -= 0.008f;
         if ((double)this._waitZoom < 0.00999999977648258)
         {
             this._waitZoom     = 0.0f;
             this._desiredState = TVState.ShowNewscaster;
         }
     }
     if (this._state == TVState.ShowHotness && this._hotness.ready)
     {
         this._talker.Resume();
     }
     if (this._state == TVState.ShowInterview)
     {
         this._interviewWait -= 0.02f;
         if ((double)this._interviewWait < 0.0 && !this._askedQuestion)
         {
             this._talker.InsertLine(Script.winner() + "! To what do you attribute your success?", this._interviewIndex);
             this._talker.Resume();
             this._askedQuestion = true;
         }
     }
     this._cameraOffset.x = Lerp.Float(this._cameraOffset.x, HighlightLevel._image != null ? 20f : 0.0f, 2f);
     this._talker.active  = this._talker.visible = this._state != TVState.ShowPedestals;
     if (this._state == this._desiredState)
     {
         return;
     }
     this._talker.active = false;
     this._transition.PlaySwipe();
     if (!this._transition.doTransition)
     {
         return;
     }
     this._state = this._desiredState;
 }
Exemple #14
0
 public override void Update()
 {
     if (this._pressWait > 0)
     {
         --this._pressWait;
     }
     if (this._editModMenu.open)
     {
         if (!UIMenu.globalUILock && (Input.Pressed("QUACK") || Keyboard.Pressed(Keys.Escape)))
         {
             this._editModMenu.Close();
             this.Open();
             return;
         }
     }
     else if (this.open)
     {
         if (this._transferItem != null && !this._needsUpdateNotes)
         {
             if (!this._transferring)
             {
                 if (this._transferItem.result == SteamResult.OK)
                 {
                     WorkshopItemData dat = new WorkshopItemData();
                     if (this._selectedMod.configuration.workshopID == 0UL)
                     {
                         this._selectedMod.configuration.SetWorkshopID(this._transferItem.id);
                         dat.name        = this._selectedMod.configuration.displayName;
                         dat.description = this._selectedMod.configuration.description;
                         dat.visibility  = RemoteStoragePublishedFileVisibility.Private;
                         dat.tags        = new List <string>();
                         dat.tags.Add("Mod");
                     }
                     else
                     {
                         dat.changeNotes = this._updateTextBox.text;
                     }
                     string pathString = this._selectedMod.configuration.directory + "/content/";
                     DuckFile.CreatePath(pathString);
                     string path1 = pathString + "screenshot.png";
                     if (!File.Exists(path1))
                     {
                         File.Delete(path1);
                         Tex2D  screenshot = this._selectedMod.screenshot;
                         Stream stream     = (Stream)DuckFile.Create(path1);
                         ((Texture2D)screenshot.nativeObject).SaveAsPng(stream, screenshot.width, screenshot.height);
                         stream.Dispose();
                     }
                     dat.previewPath = path1;
                     string str = DuckFile.workshopDirectory + (object)this._transferItem.id + "/content";
                     if (Directory.Exists(str))
                     {
                         Directory.Delete(str, true);
                     }
                     DuckFile.CreatePath(str);
                     UIModManagement.DirectoryCopy(this._selectedMod.configuration.directory, str + "/" + this._selectedMod.configuration.name, true);
                     if (Directory.Exists(str + this._selectedMod.configuration.name + "/build"))
                     {
                         Directory.Delete(str + this._selectedMod.configuration.name + "/build", true);
                     }
                     if (Directory.Exists(str + this._selectedMod.configuration.name + "/.vs"))
                     {
                         Directory.Delete(str + this._selectedMod.configuration.name + "/.vs", true);
                     }
                     if (File.Exists(str + this._selectedMod.configuration.name + "/" + this._selectedMod.configuration.name + "_compiled.dll"))
                     {
                         string path2 = str + this._selectedMod.configuration.name + "/" + this._selectedMod.configuration.name + "_compiled.dll";
                         File.SetAttributes(path2, FileAttributes.Normal);
                         File.Delete(path2);
                     }
                     if (File.Exists(str + this._selectedMod.configuration.name + "/" + this._selectedMod.configuration.name + "_compiled.hash"))
                     {
                         string path2 = str + this._selectedMod.configuration.name + "/" + this._selectedMod.configuration.name + "_compiled.hash";
                         File.SetAttributes(path2, FileAttributes.Normal);
                         File.Delete(path2);
                     }
                     dat.contentFolder = str;
                     this._transferItem.ApplyWorkshopData(dat);
                     if (this._transferItem.needsLegal)
                     {
                         Steam.ShowWorkshopLegalAgreement("312530");
                     }
                     this._transferring = true;
                     this._transferItem.ResetProcessing();
                 }
             }
             else if (this._transferItem.finishedProcessing)
             {
                 Steam.OverlayOpenURL("http://steamcommunity.com/sharedfiles/filedetails/?id=" + (object)this._transferItem.id);
                 Directory.Delete(DuckFile.workshopDirectory + (object)this._transferItem.id + "/", true);
                 this._transferItem.ResetProcessing();
                 this._transferItem = (WorkshopItem)null;
                 this._transferring = false;
             }
             base.Update();
             return;
         }
         if (this._gamepadMode)
         {
             if (this._hoverIndex < 0)
             {
                 this._hoverIndex = 0;
             }
         }
         else
         {
             this._hoverIndex = -1;
             for (int index = 0; index < this._maxModsToShow && this._scrollItemOffset + index < this._mods.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._transferItem != null)
         {
             if (this._updateTextBox != null)
             {
                 Editor.hoverTextBox           = false;
                 this._updateTextBox.position  = new Vec2((float)((double)this._box.x - (double)this._box.halfWidth + 16.0), (float)((double)this._box.y - (double)this._box.halfHeight + 48.0));
                 this._updateTextBox.size      = new Vec2(this._box.width - 32f, this._box.height - 80f);
                 this._updateTextBox._maxLines = (int)((double)this._updateTextBox.size.y / (double)this._fancyFont.characterHeight);
                 this._updateTextBox.Update();
                 float stringWidth = DuckGame.Graphics.GetStringWidth(this._updateButtonText, scale: 2f);
                 float height      = DuckGame.Graphics.GetStringHeight(this._updateButtonText) * 2f;
                 this._updateButton = new Rectangle(this._box.x - stringWidth / 2f, (float)((double)this._box.y + (double)this._box.halfHeight - 24.0), stringWidth, height);
                 if (this._updateButton.Contains(Mouse.position) && Mouse.left == InputState.Pressed)
                 {
                     this._needsUpdateNotes = false;
                     this._updateTextBox.LoseFocus();
                 }
                 else if (Keyboard.Pressed(Keys.Escape))
                 {
                     this._needsUpdateNotes = false;
                     this._transferItem     = (WorkshopItem)null;
                     this._updateTextBox.LoseFocus();
                     new UIMenuActionOpenMenu((UIComponent)this, (UIComponent)this._editModMenu).Activate();
                     return;
                 }
             }
         }
         else if (this._hoverIndex != -1)
         {
             this._selectedMod = this._mods[this._hoverIndex];
             if (Input.Pressed("SHOOT"))
             {
                 if (this._selectedMod != null && this._selectedMod.configuration != null)
                 {
                     if (this._selectedMod.configuration.disabled)
                     {
                         this._selectedMod.configuration.Enable();
                     }
                     else
                     {
                         this._selectedMod.configuration.Disable();
                     }
                     this.modsChanged = true;
                     SFX.Play("rockHitGround", 0.8f);
                 }
             }
             else if (Input.Pressed("SELECT") && this._pressWait == 0 && this._gamepadMode || !this._gamepadMode && Mouse.left == InputState.Pressed)
             {
                 if (this._selectedMod != null)
                 {
                     this._editModMenu.title = this._selectedMod.configuration.loaded ? "|YELLOW|" + this._selectedMod.configuration.displayName : "|YELLOW|" + this._selectedMod.configuration.name;
                     this._editModMenu.Remove((UIComponent)this._deleteOrUnsubItem);
                     this._editModMenu.Remove((UIComponent)this._uploadItem);
                     this._editModMenu.Remove((UIComponent)this._visitItem);
                     if (!this._selectedMod.configuration.isWorkshop && this._selectedMod.configuration.loaded)
                     {
                         this._uploadItem.text = this._selectedMod.configuration.workshopID == 0UL ? "UPLOAD" : "UPDATE";
                         this._editModMenu.Insert((UIComponent)this._uploadItem, 1, true);
                     }
                     if (!this._selectedMod.configuration.isWorkshop && !this._selectedMod.configuration.loaded)
                     {
                         this._deleteOrUnsubItem.text = "DELETE";
                         this._editModMenu.Insert((UIComponent)this._deleteOrUnsubItem, 1, true);
                     }
                     else if (this._selectedMod.configuration.isWorkshop)
                     {
                         this._deleteOrUnsubItem.text = "UNSUBSCRIBE";
                         this._editModMenu.Insert((UIComponent)this._deleteOrUnsubItem, 1, true);
                     }
                     if (this._selectedMod.configuration.isWorkshop)
                     {
                         this._editModMenu.Insert((UIComponent)this._visitItem, 1, true);
                     }
                     this._disableOrEnableItem.text = this._selectedMod.configuration.disabled ? "ENABLE" : "DISABLE";
                     this._editModMenu.dirty        = true;
                     SFX.Play("rockHitGround", 0.8f);
                     new UIMenuActionOpenMenu((UIComponent)this, (UIComponent)this._editModMenu).Activate();
                     return;
                 }
                 Steam.OverlayOpenURL("http://steamcommunity.com/workshop/browse/?appid=312530&searchtext=&childpublishedfileid=0&browsesort=trend&section=readytouseitems&requiredtags%5B%5D=Mod");
             }
         }
         else
         {
             this._selectedMod = (Mod)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._mods.Count - this._maxModsToShow) * (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._mods.Count - this._maxModsToShow))
         {
             this._scrollItemOffset = Math.Max(0, this._mods.Count - this._maxModsToShow);
         }
         if (this._hoverIndex >= this._mods.Count)
         {
             this._hoverIndex = this._mods.Count - 1;
         }
         else if (this._hoverIndex >= this._scrollItemOffset + this._maxModsToShow)
         {
             this._scrollItemOffset += this._hoverIndex - (this._scrollItemOffset + this._maxModsToShow) + 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._mods.Count - this._maxModsToShow));
         if (!Editor.hoverTextBox && !UIMenu.globalUILock && (Input.Pressed("QUACK") || Keyboard.Pressed(Keys.Escape)))
         {
             if (this.modsChanged)
             {
                 this.Close();
                 MonoMain.pauseMenu = DuckNetwork.OpenModsRestartWindow(this._openOnClose);
             }
             else
             {
                 new UIMenuActionOpenMenu((UIComponent)this, (UIComponent)this._openOnClose).Activate();
             }
             this.modsChanged = false;
             return;
         }
     }
     if (this._showingMenu)
     {
         HUD.CloseAllCorners();
         this._showingMenu = false;
     }
     base.Update();
 }
        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()
 {
     this.yOffset = Lerp.FloatSmooth(this.yOffset, this.down ? 150f : 0.0f, 0.3f, 1.1f);
     if (this.down)
     {
         if (this._unlocks.Count == 0)
         {
             if (!this.finished)
             {
                 this.finished = true;
                 this.Close();
             }
         }
         else
         {
             this._downWait -= 0.06f;
             if ((double)this._downWait <= 0.0)
             {
                 this._openWait = 1f;
                 this._wrapped  = true;
                 this._downWait = 1f;
                 this._unlock   = this._unlocks.First <Unlockable>();
                 this._unlocks.RemoveAt(0);
                 this.down = false;
                 SFX.Play("pause", 0.6f);
             }
         }
     }
     else
     {
         this._openWait -= 0.06f;
         if ((double)this._openWait <= 0.0 && this._wrapped && !this._flash)
         {
             this._flash = true;
         }
         if (this._flash)
         {
             Graphics.flashAdd = Lerp.Float(Graphics.flashAdd, 1f, 0.2f);
             if ((double)Graphics.flashAdd > 0.990000009536743)
             {
                 this._wrapped = !this._wrapped;
                 if (!this._wrapped)
                 {
                     if (this._unlock != null && this._unlock.name == "UR THE BEST")
                     {
                         this._oldSong = Music.currentSong;
                         Music.Play("jollyjingle");
                     }
                     SFX.Play("harp");
                     HUD.AddCornerControl(HUDCorner.BottomRight, "@SELECT@CONTINUE");
                     this._unlock.DoUnlock();
                 }
                 this._flash = false;
             }
         }
         else
         {
             Graphics.flashAdd = Lerp.Float(Graphics.flashAdd, 0.0f, 0.2f);
         }
         if (!this._wrapped && Input.Pressed("SELECT"))
         {
             HUD.CloseAllCorners();
             SFX.Play("resume", 0.6f);
             if (this._oldSong != null && this._unlock != null && this._unlock.name == "UR THE BEST")
             {
                 Music.Play(this._oldSong);
             }
             this.down = true;
         }
     }
     base.Update();
 }
 public override void Update()
 {
     if (this._desiredTransition != this._transition)
     {
         this._fade = Lerp.Float(this._fade, 0.0f, 0.06f);
         if ((double)this._fade <= 0.0)
         {
             this._transition = this._desiredTransition;
             if (this._transition == DoorTransition.Profile)
             {
                 Graphics.fade = 0.0f;
                 Level.current = (Level) new LockerRoom(this._profile);
             }
             else if (this._transition == DoorTransition.Exit)
             {
                 Graphics.fade = 0.0f;
                 Level.current = (Level) new TitleScreen();
             }
             else if (this._transition == DoorTransition.Album)
             {
                 Graphics.fade = 0.0f;
                 Level.current = (Level) new Album();
             }
         }
     }
     else
     {
         this._fade = Lerp.Float(this._fade, 1f, 0.06f);
         if (this._selectorPosition == this._desiredSelectorPosition)
         {
             if (InputProfile.active.Down("LEFT"))
             {
                 this.SelectUp();
             }
             if (InputProfile.active.Down("RIGHT"))
             {
                 this.SelectDown();
             }
             if (InputProfile.active.Pressed("SELECT") && this._profile != null)
             {
                 this._desiredTransition = DoorTransition.Profile;
                 HUD.CloseAllCorners();
             }
         }
         if (InputProfile.active.Pressed("QUACK"))
         {
             this._desiredTransition = DoorTransition.Exit;
             HUD.CloseAllCorners();
         }
         if (InputProfile.active.Pressed("GRAB"))
         {
             this._desiredTransition = DoorTransition.Album;
             HUD.CloseAllCorners();
         }
         if ((double)this._slideTo != 0.0 && (double)this._slide != (double)this._slideTo)
         {
             this._slide = Lerp.Float(this._slide, this._slideTo, 0.05f);
         }
         else if ((double)this._slideTo != 0.0 && (double)this._slide == (double)this._slideTo)
         {
             this._slide   = 0.0f;
             this._slideTo = 0.0f;
             SFX.Play("textLetter", 0.7f);
             this._selectorPosition = this._desiredSelectorPosition;
             if (this._profiles.Count > 0)
             {
                 this._profile = this._profiles[this._selectorPosition];
             }
         }
     }
     base.Update();
 }
 public override void UpdateParts()
 {
     if (!this.doubleUpdating && Input.Down("JUMP"))
     {
         this.doubleUpdating = true;
         this.UpdateParts();
         this.doubleUpdating = false;
     }
     if (!this.down && (double)this.yOffset > -1.0)
     {
         if ((double)this._initialWait < 1.0)
         {
             this._initialWait += 0.06f;
         }
         else if ((double)this._insertCoin < 1.0)
         {
             if (!this._chinged)
             {
                 SFX.Play("ching", pitch: Rando.Float(0.4f, 0.6f));
                 this._chinged = true;
             }
             this._insertCoinInc += 0.008f;
             this._insertCoin    += this._insertCoinInc;
         }
         else
         {
             this._insertCoin = 1f;
             if ((double)this._afterInsertWait < 1.0)
             {
                 this._afterInsertWait += 0.2f;
             }
             else
             {
                 if ((double)this._gachaWait >= 0.200000002980232 && !this.played)
                 {
                     this.played = true;
                     SFX.Play("gachaSound", pitch: Rando.Float(-0.1f, 0.1f));
                 }
                 if (!this._coined && (double)this._gachaWait > 0.200000002980232)
                 {
                     SFX.Play("gachaCoin", pitch: Rando.Float(0.4f, 0.6f));
                     this._coined = true;
                 }
                 this._gachaWait += 0.04f;
                 if ((double)this._gachaWait >= 1.0)
                 {
                     this._gachaWait  = 1f;
                     this.gachaSpeed += 0.25f;
                     if ((double)this.gachaSpeed > 6.0)
                     {
                         this.gachaSpeed = 6f;
                     }
                     this.gachaY += this.gachaSpeed;
                     if ((double)this.gachaY > 50.0 && (double)this.gachaSpeed > 0.0)
                     {
                         if ((double)this.gachaSpeed > 0.800000011920929)
                         {
                             SFX.Play("gachaBounce", pitch: 0.2f);
                         }
                         this.gachaY     = 50f;
                         this.gachaSpeed = (float)(-(double)this.gachaSpeed * 0.400000005960464);
                     }
                     float num = 8f;
                     this._toyVelocity.y += 0.2f;
                     Vec2 toyPosition1 = this._toyPosition;
                     if ((double)toyPosition1.length > (double)num)
                     {
                         Vec2 toyPosition2 = this._toyPosition;
                         this._toyPosition = toyPosition1.normalized * num;
                         Vec2 vec2 = this._toyPosition - toyPosition2;
                         this._toyVelocity += vec2;
                         if ((double)vec2.length > 1.0)
                         {
                             SFX.Play("gachaBounce", pitch: (0.7f + Rando.Float(0.2f)));
                         }
                         this._toyAngleLerp = Maths.PointDirection(Vec2.Zero, this._toyPosition);
                     }
                     Vec2 leftStick = InputProfile.active.leftStick;
                     if (InputProfile.active.lastActiveDevice is Keyboard)
                     {
                         if (InputProfile.active.Down("LEFT"))
                         {
                             leftStick.x = -1f;
                         }
                         if (InputProfile.active.Down("RIGHT"))
                         {
                             leftStick.x = 1f;
                         }
                         if (InputProfile.active.Down("UP"))
                         {
                             leftStick.y = 1f;
                         }
                         if (InputProfile.active.Down("DOWN"))
                         {
                             leftStick.y = -1f;
                         }
                     }
                     this._toyVelocity  += (this._lastStick - leftStick) * new Vec2(2f, -2f);
                     this._lastStick     = leftStick;
                     this._toyVelocity.x = Math.Max(Math.Min(this._toyVelocity.x, 3f), -3f);
                     this._toyVelocity.y = Math.Max(Math.Min(this._toyVelocity.y, 3f), -3f);
                     this._toyPosition  += this._toyVelocity;
                     if (!this.opened)
                     {
                         this._toyAngle  = Lerp.FloatSmooth(this._toyAngle, this._toyAngleLerp, 0.1f);
                         this._eggOffset = Lerp.Vec2Smooth(this._eggOffset, leftStick * 8f, 0.3f);
                     }
                     else
                     {
                         this._toyAngle    = Lerp.FloatSmooth(this._toyAngle, -90f, 0.1f);
                         this._eggOffset   = Lerp.Vec2Smooth(this._eggOffset, Vec2.Zero, 0.3f);
                         this._toyPosition = Lerp.Vec2Smooth(this._toyPosition, Vec2.Zero, 0.3f);
                     }
                     this._openWait += 0.029f;
                     if ((double)this._openWait >= 1.0)
                     {
                         if (!this.didOpenToyCorner)
                         {
                             HUD.AddCornerControl(HUDCorner.BottomRight, "@SELECT@OPEN TOY");
                             this.didOpenToyCorner = true;
                         }
                         if (Input.Pressed("SELECT") && !this.opened)
                         {
                             this.opened = true;
                             SFX.Play("gachaOpen", pitch: Rando.Float(0.1f, 0.3f));
                             this._gachaEgg.frame += 2;
                         }
                         if (this.opened)
                         {
                             this._swapWait += 0.06f;
                             if ((double)this._swapWait >= 1.0)
                             {
                                 if (!this._swapped)
                                 {
                                     SFX.Play("harp");
                                     HUD.CloseAllCorners();
                                     HUD.AddCornerControl(HUDCorner.BottomRight, "@SELECT@CONTINUE");
                                     Profiles.experienceProfile.SetNumFurnitures((int)this._contains.index, Profiles.experienceProfile.GetNumFurnitures((int)this._contains.index) + 1);
                                 }
                                 this._starGrow += 0.05f;
                                 this._swapped   = true;
                             }
                         }
                     }
                 }
             }
         }
     }
     this.yOffset = Lerp.FloatSmooth(this.yOffset, this.down ? -250f : 0.0f, 0.4f);
     if (this.down)
     {
         if (this._swapped)
         {
             this.finished = true;
             this.Close();
         }
         else
         {
             this._downWait -= 0.06f;
             if ((double)this._downWait <= 0.0)
             {
                 this._downWait = 1f;
                 this.down      = false;
                 SFX.Play("gachaGet", pitch: -0.4f);
             }
         }
     }
     if (!this.down && this._swapped && Input.Pressed("SELECT"))
     {
         this.played           = false;
         this._gachaWait       = 0.0f;
         this._openWait        = 0.0f;
         this.finished         = false;
         this.opened           = false;
         this._swapWait        = 0.0f;
         this._swapped         = false;
         this._starGrow        = 0.0f;
         this._insertCoin      = 0.0f;
         this._insertCoinInc   = 0.0f;
         this._afterInsertWait = 0.0f;
         this._chinged         = false;
         this.gachaY           = 0.0f;
         this.gachaSpeed       = 0.0f;
         this.doubleUpdating   = false;
         ++this._prizesGiven;
         this._eggOffset       = Vec2.Zero;
         this._toyPosition     = Vec2.Zero;
         this._toyVelocity     = Vec2.Zero;
         this._lastStick       = Vec2.Zero;
         this._toyAngle        = 0.0f;
         this._toyAngleLerp    = 0.0f;
         this._coined          = false;
         this._initialWait     = 0.0f;
         this.didOpenToyCorner = false;
         HUD.CloseAllCorners();
         SFX.Play("resume", 0.6f);
         if (this.prizes.Count > 4)
         {
             this.prizes.RemoveAt(0);
             this.LoadNextPrize();
         }
         else
         {
             this.down     = true;
             this._swapped = true;
         }
     }
     base.UpdateParts();
 }
 public override void Close()
 {
     HUD.CloseAllCorners();
     base.Close();
 }