Example #1
0
 public static void Update()
 {
     if (Vote._voteButton != "")
     {
         foreach (Profile who in Profiles.all.Where <Profile>((Func <Profile, bool>)(x => x.team != null)))
         {
             if (who.inputProfile != null && who.inputProfile.Pressed(Vote._voteButton))
             {
                 Vote.RegisterVote(who, VoteType.Skip);
             }
         }
     }
     if (!Vote._votes.Exists((Predicate <RegisteredVote>)(x => x.open && (double)x.slide < 0.899999976158142)))
     {
         foreach (RegisteredVote vote in Vote._votes)
         {
             if (vote.doClose)
             {
                 vote.open = false;
             }
         }
     }
     foreach (RegisteredVote vote in Vote._votes)
     {
         vote.slide      = Lerp.FloatSmooth(vote.slide, vote.open ? 1f : -0.1f, 0.1f, 1.1f);
         vote.wobble     = Lerp.Float(vote.wobble, 0.0f, 0.05f);
         vote.wobbleInc += 0.5f;
     }
     Vote._votes.RemoveAll((Predicate <RegisteredVote>)(x => !x.open && (double)x.slide < 0.00999999977648258));
 }
Example #2
0
 public override void Update()
 {
     Layer.HUD.camera.x = CategoryPage.camOffset;
     if (this._state == CategoryState.OpenPage)
     {
         this._strip.active     = false;
         CategoryPage.camOffset = Lerp.FloatSmooth(CategoryPage.camOffset, 360f, 0.1f);
         if ((double)CategoryPage.camOffset <= 330.0 || !(this._pageToOpen.specialText == "VIEW ALL"))
         {
             return;
         }
         Level.current = (Level) new CategoryPage(this._cards, true);
     }
     else
     {
         if (this._state != CategoryState.Idle)
         {
             return;
         }
         CategoryPage.camOffset = Lerp.FloatSmooth(CategoryPage.camOffset, -40f, 0.1f);
         if ((double)CategoryPage.camOffset < 0.0)
         {
             CategoryPage.camOffset = 0.0f;
         }
         this._strip.active = (double)CategoryPage.camOffset == 0.0;
     }
 }
        public override void Update()
        {
            if (GameMode.started)
            {
                Level.Remove((Thing)this);
            }
            this.distOut = Lerp.FloatSmooth(this.distOut, 16f, 0.08f, 1.2f);
            this.distLen = Lerp.FloatSmooth(this.distLen, 10f, 0.08f, 1.2f);
            this.rot     = Lerp.FloatSmooth(this.rot, 45f, 0.08f, 1.1f);
            if ((double)Math.Abs(this.rot - 45f) < 20.0)
            {
                this.streamAlpha -= 0.03f;
                if ((double)this.streamAlpha < 0.0)
                {
                    this.streamAlpha = 0.0f;
                }
            }
            Vec2 to = Vec2.Transform(this.targetPos, Level.current.camera.getMatrix());

            to.x         *= this.layer.camera.width / (float)Graphics.width;
            to.y         *= this.layer.camera.height / (float)Graphics.height;
            this.position = Lerp.Vec2Smooth(this.position, to, 0.2f);
            if ((double)(this.position - to).length > 16.0)
            {
                this.prevPos.Add(this.position);
            }
            this.sizeWaver += 0.2f;
        }
 public override void Draw()
 {
     this.depth = new Depth(-0.12f);
     if ((double)this._vertPush > 0.0)
     {
         this.depth = new Depth(-0.11f);
     }
     if (this._graphic != null)
     {
         this._graphic.position = this.position + new Vec2(0.0f * this.shiftTime, this._vertPush * 1.5f);
         this._graphic.alpha    = this.alpha;
         this._graphic.angle    = this.angle;
         this._graphic.depth    = this.depth;
         this._graphic.scale    = this.scale + new Vec2(Math.Abs((float)this.shiftAmount * 0.0f) * this.shiftTime, this._vertPush * 0.2f);
         this._graphic.center   = this.center;
         this._graphic.Draw();
     }
     if ((double)this.shiftTime > 0.0)
     {
         this._graphic.position = this.position + new Vec2((float)(this.shiftAmount * 2) * this.shiftTime, 0.0f);
         this._graphic.alpha    = this.alpha;
         this._graphic.angle    = this.angle;
         this._graphic.depth    = this.depth + 10;
         this._graphic.scale    = this.scale + new Vec2(Math.Abs((float)this.shiftAmount * 0.0f) * this.shiftTime, 0.0f);
         this._graphic.center   = this.center;
         this._graphic.alpha    = 0.6f;
         this._graphic.Draw();
     }
     this.shiftTime = Lerp.FloatSmooth(this.shiftTime, 0.0f, 0.1f);
     if ((double)this.shiftTime < 0.0500000007450581)
     {
         this.shiftTime = 0.0f;
     }
     this._vertPush = Lerp.FloatSmooth(this._vertPush, 0.0f, 0.3f);
     if ((double)this._vertPush >= 0.0500000007450581)
     {
         return;
     }
     this._vertPush = 0.0f;
 }
 public override void Update()
 {
     if (this._playSwipe)
     {
         this._transitionWait += 0.02f;
         if ((double)this._transitionWait > 1.0)
         {
             this._doTransition = true;
         }
         if ((double)this._slideOutWait < 1.0)
         {
             this._duckLerp      = Lerp.FloatSmooth(this._duckLerp, 1f, 0.1f, 1.1f);
             this._channelLerp   = Lerp.FloatSmooth(this._channelLerp, 1f, 0.1f, 1.1f);
             this._fiveLerp      = Lerp.FloatSmooth(this._fiveLerp, 1f, 0.1f, 1.1f);
             this._slideOutWait += 0.012f;
         }
         else
         {
             this._duckLerp    = Lerp.FloatSmooth(this._duckLerp, 0.0f, 0.1f, 1.1f);
             this._channelLerp = Lerp.FloatSmooth(this._channelLerp, 0.0f, 0.1f, 1.1f);
             this._fiveLerp    = Lerp.FloatSmooth(this._fiveLerp, 0.0f, 0.1f, 1.1f);
             if ((double)this._duckLerp < 0.00999999977648258)
             {
                 this._playSwipe = false;
             }
         }
         for (int index = 0; index < this._swipeLines.Count; ++index)
         {
             this._swipeLines[index] = Lerp.Float(this._swipeLines[index], 1f, this._swipeSpeeds[index]);
         }
     }
     else
     {
         this._doTransition = false;
     }
 }
 public static void Update()
 {
     foreach (KeyValuePair <NetworkConnection, ConnectionIndicatorElement> connection in ConnectionIndicator._connections)
     {
         if (connection.Value.duck != null && (connection.Value.duck.removeFromLevel || connection.Value.duck.level != Level.current))
         {
             connection.Value.duck = (Duck)null;
         }
         connection.Value.position = connection.Value.duck == null ? new Vec2(-1000f, -1000f) : connection.Value.duck.cameraPosition;
         foreach (KeyValuePair <ConnectionIndicatorType, ConnectionIndicatorDetail> detail in connection.Value.details)
         {
             detail.Value.buildup -= Maths.IncFrameTimer() * 0.25f;
             if ((double)detail.Value.buildup > (double)detail.Value.maxBuildup)
             {
                 detail.Value.buildup = detail.Value.maxBuildup;
             }
             if ((double)detail.Value.buildup < 0.0)
             {
                 detail.Value.buildup = 0.0f;
                 detail.Value.popOut += 0.02f;
                 if ((double)detail.Value.popOut > 1.0)
                 {
                     detail.Value.popOut = 1f;
                 }
                 detail.Value.grow -= 0.1f;
                 if ((double)detail.Value.grow < 0.0)
                 {
                     detail.Value.grow = 0.0f;
                 }
             }
             else
             {
                 detail.Value.popOut = 0.0f;
                 detail.Value.grow   = Lerp.FloatSmooth(detail.Value.grow, 1f, 0.2f);
                 if ((double)detail.Value.grow > 1.0)
                 {
                     detail.Value.grow = 1f;
                 }
             }
         }
     }
     foreach (Duck duck in Level.current.things[typeof(Duck)])
     {
         NetworkConnection key = (NetworkConnection)null;
         if (duck.profile != null && duck.profile.connection != null)
         {
             key = duck.profile.connection;
         }
         if (Network.isActive && key != null)
         {
             ConnectionIndicatorElement indicatorElement = (ConnectionIndicatorElement)null;
             if (!ConnectionIndicator._connections.TryGetValue(key, out indicatorElement))
             {
                 indicatorElement = new ConnectionIndicatorElement();
                 ConnectionIndicator._connections[key] = indicatorElement;
             }
             indicatorElement.duck = duck;
             if ((double)key.manager.ping > 0.25)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Lag).buildup += Maths.IncFrameTimer();
             }
             if ((double)key.manager.ping > 0.899999976158142 || key.status != ConnectionStatus.Connected)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Failure).buildup += Maths.IncFrameTimer();
             }
             if (key.manager.lossThisFrame)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Loss).buildup += 0.2f;
                 key.manager.lossThisFrame = false;
             }
             if ((double)key.manager.jitter > 0.800000011920929)
             {
                 indicatorElement.GetDetail(ConnectionIndicatorType.Loss).buildup += 0.25f;
             }
             ConnectionIndicatorDetail detail1 = indicatorElement.GetDetail(ConnectionIndicatorType.AFK);
             if (!duck.afk)
             {
                 detail1.buildup = 0.0f;
             }
             else
             {
                 detail1.buildup += Maths.IncFrameTimer();
             }
             ConnectionIndicatorDetail detail2 = indicatorElement.GetDetail(ConnectionIndicatorType.Chatting);
             if (duck.chatting)
             {
                 detail2.buildup += 0.25f;
             }
             else
             {
                 detail2.buildup = 0.0f;
             }
         }
     }
     if (ConnectionIndicator._lagIcons != null)
     {
         return;
     }
     ConnectionIndicator._lagIcons = new SpriteMap("lagturtle", 16, 16);
     ConnectionIndicator._lagIcons.CenterOrigin();
     ConnectionIndicator._rainbowGradient = new Sprite("rainbowGradient");
 }
Example #7
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;
            }
        }
 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;
     }
 }
Example #9
0
        // Token: 0x0600230C RID: 8972
        public override void Update()
        {
            base.Update();
            float num = 1f;

            if (this.souped)
            {
                num = 1.3f;
            }
            if (this._swordSwing.finished)
            {
                this._swordSwing.speed = 0f;
            }
            if (this._hitWait > 0)
            {
                this._hitWait--;
            }
            if (this._gas < 0.01f)
            {
                this.ammo = 0;
            }
            this._framesExisting++;
            if (this._framesExisting > 100)
            {
                this._framesExisting = 100;
            }
            float pitch = this.souped ? 0.3f : 0f;

            this._sound.lerpVolume = ((this._started && !this._throttle) ? 0.6f : 0f);
            this._sound.pitch      = pitch;
            if (this._started)
            {
                this._warmUp += 0.001f;
                if (this._warmUp > 1f)
                {
                    this._warmUp = 1f;
                }
                if (!this._puffClick && this._idleWave > 0.9f)
                {
                    this._skipSmoke = !this._skipSmoke;
                    if (this._throttle || !this._skipSmoke)
                    {
                        Level.Add(SmallSmoke.New(base.x + (float)(this.offDir * 4), base.y + 5f, this._smokeFlipper ? -0.1f : 0.8f, 0.7f));
                        this._smokeFlipper = !this._smokeFlipper;
                        this._puffClick    = true;
                    }
                }
                else if (this._puffClick && this._idleWave < 0f)
                {
                    this._puffClick = false;
                }
                if (this._pullState < 0)
                {
                    float num2 = 1f + Maths.NormalizeSection(this._engineSpin, 1f, 2f) * 2f;
                    float num3 = this._idleWave;
                    if (num2 > 1f)
                    {
                        num3 = this._spinWave;
                    }
                    this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(0f, 2f + num3 * num2), 0.23f);
                    this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f + num3 * num2), 0.23f);
                    float num4 = Maths.NormalizeSection(this._engineSpin, 1f, 2f) * 3f;
                    this._rotSway = this._idleWave.normalized * num4 * 0.03f;
                }
                else
                {
                    this._rotSway = 0f;
                }
                this._gas -= 3E-05f;
                if (this._throttle)
                {
                    this._gas -= 0.0002f;
                }
                if (this._gas < 0f)
                {
                    this._gas      = 0f;
                    this._started  = false;
                    this._throttle = false;
                }
                if (this._triggerHeld)
                {
                    if (this._releasedSincePull)
                    {
                        if (!this._throttle)
                        {
                            this._throttle = true;
                            SFX.Play("chainsawBladeRevUp", 0.5f, pitch, 0f, false);
                        }
                        this._engineSpin = Lerp.FloatSmooth(this._engineSpin, 4f, 0.1f, 1f);
                    }
                }
                else
                {
                    if (this._throttle)
                    {
                        this._throttle = false;
                        if (this._engineSpin > 1.7f)
                        {
                            SFX.Play("chainsawBladeRevDown", 0.5f, pitch, 0f, false);
                        }
                    }
                    this._engineSpin        = Lerp.FloatSmooth(this._engineSpin, 0f, 0.1f, 1f);
                    this._releasedSincePull = true;
                }
            }
            else
            {
                this._warmUp -= 0.001f;
                if (this._warmUp < 0f)
                {
                    this._warmUp = 0f;
                }
                this._releasedSincePull = false;
                this._throttle          = false;
            }
            this._bladeSound.lerpSpeed  = 0.1f;
            this._throttleWait          = Lerp.Float(this._throttleWait, this._throttle ? 1f : 0f, 0.07f);
            this._bladeSound.lerpVolume = ((this._throttleWait > 0.96f) ? 0.6f : 0f);
            if (this._struggling)
            {
                this._bladeSound.lerpVolume = 0f;
            }
            this._bladeSoundLow.lerpVolume = ((this._throttleWait > 0.96f && this._struggling) ? 0.6f : 0f);
            this._bladeSound.pitch         = pitch;
            this._bladeSoundLow.pitch      = pitch;
            if (this.owner == null)
            {
                this.collisionOffset = new Vec2(-8f, -6f);
                this.collisionSize   = new Vec2(13f, 11f);
            }
            else if (base.duck != null && (base.duck.sliding || base.duck.crouch))
            {
                this.collisionOffset = new Vec2(-8f, -6f);
                this.collisionSize   = new Vec2(6f, 11f);
            }
            else
            {
                this.collisionOffset = new Vec2(-8f, -6f);
                this.collisionSize   = new Vec2(10f, 11f);
            }
            if (this.owner != null)
            {
                this._resetDuck = false;
                if (this._pullState == -1)
                {
                    if (!this._started)
                    {
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(0f, 2f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f), 0.23f);
                    }
                    this._upWait = 0f;
                }
                else if (this._pullState == 0)
                {
                    this._animRot    = Lerp.FloatSmooth(this._animRot, -0.4f, 0.15f, 1f);
                    this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(-2f, -2f), 0.25f);
                    this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(-4f, 4f), 0.23f);
                    if (this._animRot <= -0.35f)
                    {
                        this._animRot   = -0.4f;
                        this._pullState = 1;
                        this.PullEngine();
                    }
                    this._upWait = 0f;
                }
                else if (this._pullState == 1)
                {
                    this._releasePull = false;
                    this._holdOffset  = Lerp.Vec2Smooth(this._holdOffset, new Vec2(2f, 3f), 0.23f);
                    this.handOffset   = Lerp.Vec2Smooth(this.handOffset, new Vec2(-4f, -2f), 0.23f);
                    this._animRot     = Lerp.FloatSmooth(this._animRot, -0.5f, 0.07f, 1f);
                    if (this._animRot < -0.45f)
                    {
                        this._animRot   = -0.5f;
                        this._pullState = 2;
                    }
                    this._upWait = 0f;
                }
                else if (this._pullState == 2)
                {
                    if (this._releasePull || !this._triggerHeld)
                    {
                        this._releasePull = true;
                        if (this._started)
                        {
                            this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(0f, 2f + this._idleWave.normalized), 0.23f);
                            this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f + this._idleWave.normalized), 0.23f);
                            this._animRot    = Lerp.FloatSmooth(this._animRot, 0f, 0.1f, 1f);
                            if (this._animRot > -0.07f)
                            {
                                this._animRot   = 0f;
                                this._pullState = -1;
                            }
                        }
                        else
                        {
                            this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(-4f, 4f), 0.24f);
                            this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(-2f, -2f), 0.24f);
                            this._animRot    = Lerp.FloatSmooth(this._animRot, -0.4f, 0.12f, 1f);
                            if (this._animRot > -0.44f)
                            {
                                this._releasePull = false;
                                this._animRot     = -0.4f;
                                this._pullState   = 3;
                                this._holdOffset  = new Vec2(-4f, 4f);
                                this.handOffset   = new Vec2(-2f, -2f);
                            }
                        }
                    }
                    this._upWait = 0f;
                }
                else if (this._pullState == 3)
                {
                    this._releasePull = false;
                    this._upWait     += 0.1f;
                    if (this._upWait > 6f)
                    {
                        this._pullState = -1;
                    }
                }
                this._bladeSpin += this._engineSpin;
                while (this._bladeSpin >= 1f)
                {
                    this._bladeSpin -= 1f;
                    int num5 = this._sprite.frame + 1;
                    if (num5 > 15)
                    {
                        num5 = 0;
                    }
                    this._sprite.frame = num5;
                }
                this._engineSpin        = Lerp.FloatSmooth(this._engineSpin, 0f, 0.1f, 1f);
                this._engineResistance  = Lerp.FloatSmooth(this._engineResistance, 1f, 0.01f, 1f);
                this._hold              = -0.4f;
                this.center             = new Vec2(8f, 7f);
                this._framesSinceThrown = 0;
            }
            else
            {
                this._rotSway = 0f;
                this._shing   = false;
                this._animRot = Lerp.FloatSmooth(this._animRot, 0f, 0.18f, 1f);
                if (this._framesSinceThrown == 1)
                {
                    this._throwSpin = base.angleDegrees;
                }
                this._hold        = 0f;
                base.angleDegrees = this._throwSpin;
                this.center       = new Vec2(8f, 7f);
                bool flag  = false;
                bool flag2 = false;
                if ((Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed) > 2f || !base.grounded) && this.gravMultiplier > 0f)
                {
                    if (!base.grounded && Level.CheckRect <Block>(this.position + new Vec2(-8f, -6f), this.position + new Vec2(8f, -2f), null) != null)
                    {
                        flag2 = true;
                    }
                    if (!flag2 && !this._grounded && Level.CheckPoint <IPlatform>(this.position + new Vec2(0f, 8f), null, null) == null)
                    {
                        if (this.offDir > 0)
                        {
                            this._throwSpin += (Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed)) * 1f + 5f;
                        }
                        else
                        {
                            this._throwSpin -= (Math.Abs(this.hSpeed) + Math.Abs(this.vSpeed)) * 1f + 5f;
                        }
                        flag = true;
                    }
                }
                if (!flag || flag2)
                {
                    this._throwSpin %= 360f;
                    if (this._throwSpin < 0f)
                    {
                        this._throwSpin += 360f;
                    }
                    if (flag2)
                    {
                        if (Math.Abs(this._throwSpin - 90f) < Math.Abs(this._throwSpin + 90f))
                        {
                            this._throwSpin = Lerp.Float(this._throwSpin, 90f, 16f);
                        }
                        else
                        {
                            this._throwSpin = Lerp.Float(-90f, 0f, 16f);
                        }
                    }
                    else if (this._throwSpin > 90f && this._throwSpin < 270f)
                    {
                        this._throwSpin = Lerp.Float(this._throwSpin, 180f, 14f);
                    }
                    else
                    {
                        if (this._throwSpin > 180f)
                        {
                            this._throwSpin -= 360f;
                        }
                        else if (this._throwSpin < -180f)
                        {
                            this._throwSpin += 360f;
                        }
                        this._throwSpin = Lerp.Float(this._throwSpin, 0f, 14f);
                    }
                }
            }
            if (Math.Abs(this._angle) > 1f)
            {
                this._flood += 0.005f;
                if (this._flood > 1f)
                {
                    this._flooded = true;
                    this._started = false;
                }
                this._gasDripFrames++;
                if (this._gas > 0f && this._flooded && this._gasDripFrames > 2)
                {
                    FluidData gas = Fluid.Gas;
                    gas.amount = 0.003f;
                    this._gas -= 0.005f;
                    if (this._gas < 0f)
                    {
                        this._gas = 0f;
                    }
                    Level.Add(new Fluid(base.x, base.y, Vec2.Zero, gas, null, 1f));
                    this._gasDripFrames = 0;
                }
                if (this._gas <= 0f)
                {
                    this._started = false;
                }
            }
            else
            {
                this._flood -= 0.008f;
                if (this._flood < 0f)
                {
                    this._flood = 0f;
                }
            }
            if (base.duck != null)
            {
                base.duck.frictionMult = 1f;
                if (this._skipSpark > 0)
                {
                    this._skipSpark++;
                    if (this._skipSpark > 2)
                    {
                        this._skipSpark = 0;
                    }
                }
                if (base.duck.sliding && this._throttle && this._skipSpark == 0)
                {
                    if (Level.CheckLine <Block>(this.barrelStartPos + new Vec2(0f, 8f), base.barrelPosition + new Vec2(0f, 8f), null) != null)
                    {
                        this._skipSpark = 1;
                        Vec2 value = this.position + base.barrelVector * 5f;
                        for (int i = 0; i < 2; i++)
                        {
                            Level.Add(Spark.New(value.x, value.y, new Vec2((float)this.offDir * Rando.Float(0f, 2f), Rando.Float(0.5f, 1.5f)), 0.02f));
                            value += base.barrelVector * 2f;
                            this._fireTrailWait -= 0.5f;
                            if (this.souped && this._fireTrailWait <= 0f)
                            {
                                this._fireTrailWait = 1f;
                                SmallFire smallFire = SmallFire.New(value.x, value.y, (float)this.offDir * Rando.Float(0f, 2f), Rando.Float(0.5f, 1.5f), false, null, true, null, false);
                                smallFire.waitToHurt = Rando.Float(1f, 2f);
                                smallFire.whoWait    = (this.owner as Duck);
                                Level.Add(smallFire);
                            }
                        }
                        if (this.offDir > 0 && this.owner.hSpeed < (float)(this.offDir * 6) * num)
                        {
                            this.owner.hSpeed = (float)(this.offDir * 6) * num;
                        }
                        else if (this.offDir < 0 && this.owner.hSpeed > (float)(this.offDir * 6) * num)
                        {
                            this.owner.hSpeed = (float)(this.offDir * 6) * num;
                        }
                    }
                    else if (this.offDir > 0 && this.owner.hSpeed < (float)(this.offDir * 3) * num)
                    {
                        this.owner.hSpeed = (float)(this.offDir * 3) * num;
                    }
                    else if (this.offDir < 0 && this.owner.hSpeed > (float)(this.offDir * 3) * num)
                    {
                        this.owner.hSpeed = (float)(this.offDir * 3) * num;
                    }
                }
                if (this._pullState == -1)
                {
                    if (!this._throttle)
                    {
                        this._animRot    = MathHelper.Lerp(this._animRot, 0.3f, 0.2f);
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(-2f, 2f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(-3f, 4f), 0.23f);
                    }
                    else if (this._shing)
                    {
                        this._animRot    = MathHelper.Lerp(this._animRot, -1.8f, 0.4f);
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(1f, 0f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f), 0.23f);
                        if (this._animRot < -1.5f)
                        {
                            this._shing = false;
                        }
                    }
                    else if (base.duck.crouch)
                    {
                        this._animRot    = MathHelper.Lerp(this._animRot, 0.4f, 0.2f);
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(1f, 0f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f), 0.23f);
                    }
                    else if (base.duck.inputProfile.Down("UP"))
                    {
                        this._animRot    = MathHelper.Lerp(this._animRot, -0.9f, 0.2f);
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(1f, 0f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f), 0.23f);
                    }
                    else
                    {
                        this._animRot    = MathHelper.Lerp(this._animRot, 0f, 0.2f);
                        this.handOffset  = Lerp.Vec2Smooth(this.handOffset, new Vec2(1f, 0f), 0.25f);
                        this._holdOffset = Lerp.Vec2Smooth(this._holdOffset, new Vec2(1f, 2f), 0.23f);
                    }
                }
            }
            else if (!this._resetDuck && base.prevOwner != null)
            {
                PhysicsObject physicsObject = base.prevOwner as PhysicsObject;
                if (physicsObject != null)
                {
                    physicsObject.frictionMult = 1f;
                }
                this._resetDuck = true;
            }
            if (this._skipDebris > 0)
            {
                this._skipDebris++;
            }
            if (this._skipDebris > 3)
            {
                this._skipDebris = 0;
            }
            this._struggling = false;
            if (this.owner != null && this._started && this._throttle && !this._shing)
            {
                (this.Offset(base.barrelOffset) - this.position).Normalize();
                this.Offset(base.barrelOffset);
                IEnumerable <IAmADuck> enumerable = Level.CheckLineAll <IAmADuck>(this.barrelStartPos, base.barrelPosition);
                Block block3 = Level.CheckLine <Block>(this.barrelStartPos, base.barrelPosition, null);
                if (this.owner != null)
                {
                    foreach (MaterialThing materialThing in Level.CheckLineAll <MaterialThing>(this.barrelStartPos, base.barrelPosition))
                    {
                        if (materialThing.Hurt((materialThing is Door) ? 1.8f : 0.5f))
                        {
                            if (base.duck != null && base.duck.sliding && materialThing is Door && (materialThing as Door)._jammed)
                            {
                                materialThing.Destroy(new DTImpale(this));
                            }
                            else
                            {
                                this._struggling = true;
                                if (base.duck != null)
                                {
                                    base.duck.frictionMult = 4f;
                                }
                                if (this._skipDebris == 0)
                                {
                                    this._skipDebris = 1;
                                    Vec2 value2 = Collision.LinePoint(this.barrelStartPos, base.barrelPosition, materialThing.rectangle);
                                    if (value2 != Vec2.Zero)
                                    {
                                        value2 += base.barrelVector * Rando.Float(0f, 3f);
                                        Vec2 vec = -base.barrelVector.Rotate(Rando.Float(-0.2f, 0.2f), Vec2.Zero);
                                        if (materialThing.physicsMaterial == PhysicsMaterial.Wood)
                                        {
                                            WoodDebris woodDebris = WoodDebris.New(value2.x, value2.y);
                                            woodDebris.hSpeed = vec.x * 3f;
                                            woodDebris.vSpeed = vec.y * 3f;
                                            Level.Add(woodDebris);
                                        }
                                        else if (materialThing.physicsMaterial == PhysicsMaterial.Metal)
                                        {
                                            Spark spark = Spark.New(value2.x, value2.y, Vec2.Zero, 0.02f);
                                            spark.hSpeed = vec.x * 3f;
                                            spark.vSpeed = vec.y * 3f;
                                            Level.Add(spark);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                bool flag3 = false;
                if (block3 != null && !(block3 is Door))
                {
                    this.Shing(block3);
                    if (block3 is Window)
                    {
                        block3.Destroy(new DTImpact(this));
                    }
                }
                else
                {
                    foreach (Thing thing in Level.current.things[typeof(Sword)])
                    {
                        Sword sword = (Sword)thing;
                        if (sword.owner != null && sword.crouchStance && !sword.jabStance && Collision.LineIntersect(this.barrelStartPos, base.barrelPosition, sword.barrelStartPos, sword.barrelPosition))
                        {
                            this.Shing(sword);
                            sword.Shing();
                            sword.owner.hSpeed     += (float)this.offDir * 3f;
                            sword.owner.vSpeed     -= 2f;
                            base.duck.hSpeed       += -(float)this.offDir * 3f;
                            base.duck.vSpeed       -= 2f;
                            sword.duck.crippleTimer = 1f;
                            base.duck.crippleTimer  = 1f;
                            flag3 = true;
                        }
                    }
                    if (!flag3)
                    {
                        Thing ignore = null;
                        if (base.duck != null)
                        {
                            ignore = base.duck.GetEquipment(typeof(Helmet));
                        }
                        QuadLaserBullet quadLaserBullet = Level.CheckLine <QuadLaserBullet>(this.position, base.barrelPosition, null);
                        if (quadLaserBullet != null)
                        {
                            this.Shing(quadLaserBullet);
                            Vec2  travel = quadLaserBullet.travel;
                            float length = travel.length;
                            float num6   = 1f;
                            if (this.offDir > 0 && travel.x < 0f)
                            {
                                num6 = 1.5f;
                            }
                            else if (this.offDir < 0 && travel.x > 0f)
                            {
                                num6 = 1.5f;
                            }
                            if (this.offDir > 0)
                            {
                                travel = new Vec2(length * num6, 0f);
                            }
                            else
                            {
                                travel = new Vec2(-length * num6, 0f);
                            }
                            quadLaserBullet.travel = travel;
                        }
                        else
                        {
                            Helmet helmet = Level.CheckLine <Helmet>(this.barrelStartPos, base.barrelPosition, ignore);
                            if (helmet != null && helmet.equippedDuck != null)
                            {
                                this.Shing(helmet);
                                helmet.owner.hSpeed     += (float)this.offDir * 3f;
                                helmet.owner.vSpeed     -= 2f;
                                helmet.duck.crippleTimer = 1f;
                                helmet.Hurt(0.53f);
                                flag3 = true;
                            }
                            else
                            {
                                if (base.duck != null)
                                {
                                    ignore = base.duck.GetEquipment(typeof(ChestPlate));
                                }
                                ChestPlate chestPlate = Level.CheckLine <ChestPlate>(this.barrelStartPos, base.barrelPosition, ignore);
                                if (chestPlate != null && chestPlate.equippedDuck != null)
                                {
                                    this.Shing(chestPlate);
                                    chestPlate.owner.hSpeed     += (float)this.offDir * 3f;
                                    chestPlate.owner.vSpeed     -= 2f;
                                    chestPlate.duck.crippleTimer = 1f;
                                    chestPlate.Hurt(0.53f);
                                    flag3 = true;
                                }
                            }
                        }
                    }
                }
                if (!flag3)
                {
                    foreach (Thing thing2 in Level.current.things[typeof(Chainsaw)])
                    {
                        Chainsaw chainsaw = (Chainsaw)thing2;
                        if (chainsaw != this && chainsaw.owner != null && Collision.LineIntersect(this.barrelStartPos, base.barrelPosition, chainsaw.barrelStartPos, chainsaw.barrelPosition))
                        {
                            this.Shing(chainsaw);
                            chainsaw.Shing(this);
                            chainsaw.owner.hSpeed     += (float)this.offDir * 2f;
                            chainsaw.owner.vSpeed     -= 1.5f;
                            base.duck.hSpeed          += -(float)this.offDir * 2f;
                            base.duck.vSpeed          -= 1.5f;
                            chainsaw.duck.crippleTimer = 1f;
                            base.duck.crippleTimer     = 1f;
                            flag3 = true;
                            if (Recorder.currentRecording != null)
                            {
                                Recorder.currentRecording.LogBonus();
                            }
                        }
                    }
                }
                if (!flag3)
                {
                    foreach (IAmADuck amADuck in enumerable)
                    {
                        if (amADuck != base.duck)
                        {
                            MaterialThing materialThing2 = amADuck as MaterialThing;
                            if (materialThing2 != null)
                            {
                                materialThing2.velocity += new Vec2((float)this.offDir * 0.8f, -0.8f);
                                materialThing2.Destroy(new DTImpale(this));
                                if (base.duck != null)
                                {
                                    base.duck._timeSinceChainKill = 0;
                                }
                            }
                        }
                    }
                }
            }
        }
 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();
 }
Example #11
0
        public override void Update()
        {
            ++this._framesSinceFeed;
            this.fluidWave += 0.1f;
            if ((double)this.data.amount < 9.99999974737875E-05)
            {
                Level.Remove((Thing)this);
            }
            if ((double)this.collisionSize.y > 10.0)
            {
                ++this.bubbleWait;
                if (this.bubbleWait > Rando.Int(15, 25))
                {
                    for (int index = 0; index < (int)Math.Floor((double)this.collisionSize.x / 16.0); ++index)
                    {
                        if ((double)Rando.Float(1f) > 0.850000023841858)
                        {
                            Level.Add((Thing) new TinyBubble(this.left + (float)(index * 16) + Rando.Float(-4f, 4f), this.bottom + Rando.Float(-4f), 0.0f, this.top + 10f));
                        }
                    }
                    this.bubbleWait = 0;
                }
                foreach (PhysicsObject physicsObject in Level.CheckRectAll <PhysicsObject>(this.topLeft, this.bottomRight))
                {
                    physicsObject.sleeping = false;
                }
            }
            FluidPuddle fluidPuddle = Level.CheckLine <FluidPuddle>(new Vec2(this.left, this.y), new Vec2(this.right, this.y), (Thing)this);

            if (fluidPuddle != null && (double)fluidPuddle.data.amount < (double)this.data.amount)
            {
                fluidPuddle.active = false;
                float num1 = Math.Min(fluidPuddle.left, this.left);
                float num2 = Math.Max(fluidPuddle.right, this.right);
                this.x = num1 + (float)(((double)num2 - (double)num1) / 2.0);
                this.Feed(fluidPuddle.data);
                Level.Remove((Thing)fluidPuddle);
            }
            if (this._leftStream != null)
            {
                this._leftStream.Update();
                this._leftStream.onFire = this.onFire;
            }
            if (this._rightStream != null)
            {
                this._rightStream.Update();
                this._rightStream.onFire = this.onFire;
            }
            float distance = this.FeedAmountToDistance(this.data.amount);

            if ((double)this._wide == 0.0)
            {
                this._wide = 1f / 1000f;
            }
            float num = Maths.Clamp(distance / this._wide, 1f, 99999f);

            if (this.onFire)
            {
                this._fireRise = Lerp.FloatSmooth(this._fireRise, 1f, 0.1f, 1.2f);
                if (this._framesSinceFeed > 10)
                {
                    FluidData data = this.data;
                    data.amount = -1f / 1000f;
                    this.Feed(data);
                    if ((double)this.data.amount <= 0.0)
                    {
                        this.data.amount = 0.0f;
                        this.alpha       = Lerp.Float(this.alpha, 0.0f, 0.04f);
                    }
                    else
                    {
                        this.alpha = Lerp.Float(this.alpha, 1f, 0.04f);
                    }
                    if ((double)this.alpha <= 0.0)
                    {
                        Level.Remove((Thing)this);
                    }
                }
            }
            else
            {
                this.alpha = Lerp.Float(this.alpha, 1f, 0.04f);
                if ((double)num < 3.0)
                {
                    FluidData data = this.data;
                    data.amount = -0.0001f;
                    this.Feed(data);
                }
            }
            float depth = this.CalculateDepth();

            if ((double)depth > 4.0 && !this._initializedUpperCorners)
            {
                this._initializedUpperCorners = true;
                foreach (BlockCorner groupCorner in this._block.GetGroupCorners())
                {
                    if (this._leftCorner != null && (double)groupCorner.corner.x == (double)this._leftCorner.corner.x && (double)groupCorner.corner.y < (double)this._leftCorner.corner.y)
                    {
                        if (this._topLeftCorner == null)
                        {
                            this._topLeftCorner = groupCorner;
                        }
                        else if ((double)groupCorner.corner.y > (double)this._topLeftCorner.corner.y)
                        {
                            this._topLeftCorner = groupCorner;
                        }
                    }
                    else if (this._rightCorner != null && (double)groupCorner.corner.x == (double)this._rightCorner.corner.x && (double)groupCorner.corner.y < (double)this._rightCorner.corner.y)
                    {
                        if (this._topRightCorner == null)
                        {
                            this._topRightCorner = groupCorner;
                        }
                        else if ((double)groupCorner.corner.y > (double)this._topRightCorner.corner.y)
                        {
                            this._topRightCorner = groupCorner;
                        }
                    }
                }
            }
            if (this._leftStream != null)
            {
                this._leftStream.position.y = this.y - this._collisionOffset.y;
            }
            if (this._rightStream != null)
            {
                this._rightStream.position.y = this.y - this._collisionOffset.y;
            }
            this._collisionOffset.y = -depth;
            this._collisionSize.y   = depth;
        }
 public void Update()
 {
     if (this._done && !Level.current._waitingOnTransition)
     {
         Layer.doVirtualEffect = false;
         if (this._realBackground == null)
         {
             return;
         }
         Level.activeLevel.backgroundColor = this._realBackground.backgroundColor;
         this._realBackground.scissor      = new Rectangle(0.0f, 0.0f, (float)Graphics.width, (float)Graphics.height);
         this._realBackground = (BackgroundUpdater)null;
     }
     else
     {
         if (Level.current._waitingOnTransition)
         {
             this._realBackground = (BackgroundUpdater)null;
         }
         if (this._realBackground == null)
         {
             using (IEnumerator <Thing> enumerator = Level.activeLevel.things[typeof(BackgroundUpdater)].GetEnumerator())
             {
                 if (enumerator.MoveNext())
                 {
                     this._realBackground = (BackgroundUpdater)enumerator.Current;
                 }
             }
         }
         float num = this._stick;
         if (this._scanStage == 2 && this._virtualMode)
         {
             this._backgroundColor             = this._curBackgroundColor;
             Level.activeLevel.backgroundColor = Lerp.ColorSmooth(this._backgroundColor, this._curBackgroundColor, this._stick);
             Layer.Glow.fade = Lerp.FloatSmooth(Layer.Glow.fade, 0.0f, this._stick);
         }
         if (this._scanStage == 0 && !this._virtualMode && this._realBackground != null)
         {
             Level.activeLevel.backgroundColor = Lerp.ColorSmooth(this._backgroundColor, this._realBackground.backgroundColor, this._stick);
             Layer.Glow.fade = Lerp.FloatSmooth(Layer.Glow.fade, 1f, this._stick);
         }
         if (this._scanStage == -1)
         {
             Level.activeLevel.backgroundColor = Lerp.ColorSmooth(this._backgroundColor, Color.Black, 0.1f);
         }
         if (this._scanStage < 2)
         {
             num = 0.0f;
         }
         Rectangle rectangle1 = new Rectangle((float)(int)((1.0 - (double)num) * (double)Graphics.width), 0.0f, (float)(Graphics.width - (int)((1.0 - (double)num) * (double)Graphics.width)), (float)Graphics.height);
         if (this._realBackground != null)
         {
             if ((double)rectangle1.width == 0.0)
             {
                 this._realBackground.SetVisible(false);
             }
             else
             {
                 this._realBackground.scissor = rectangle1;
                 this._realBackground.SetVisible(true);
             }
         }
         Rectangle rectangle2 = new Rectangle(0.0f, 0.0f, (float)Graphics.width - rectangle1.width, (float)Graphics.height);
         if ((double)rectangle2.width == 0.0)
         {
             this.SetVisible(false);
             this._visible = false;
         }
         else
         {
             this._scissor = rectangle2;
             this.SetVisible(true);
             this._visible = true;
         }
         float amount1 = 0.04f;
         float amount2 = 0.06f;
         if (Level.activeLevel != null)
         {
             amount1 *= Level.activeLevel.transitionSpeedMultiplier;
             amount2 *= Level.activeLevel.transitionSpeedMultiplier;
         }
         if (!this._virtualMode)
         {
             if (this._scanStage == 0)
             {
                 this._stick = Lerp.Float(this._stick, 1f, amount1);
                 if ((double)this._stick > 0.990000009536743)
                 {
                     this._stick    = 1f;
                     this._incStage = true;
                 }
             }
             else if (this._scanStage == 1)
             {
                 this._stick = Lerp.Float(this._stick, 0.0f, amount1);
                 if ((double)this._stick < 0.00999999977648258)
                 {
                     this._stick    = 0.0f;
                     this._incStage = true;
                 }
             }
             else if (this._scanStage == 2)
             {
                 Layer.basicWireframeEffect.effect.Parameters["screenCross"].SetValue(0.0f);
                 if (Layer.basicWireframeTex)
                 {
                     Layer.basicWireframeEffect.effect.Parameters["scanMul"].SetValue(0.0f);
                 }
                 this._stick = Lerp.Float(this._stick, 1f, amount1);
                 if ((double)this._stick > 0.990000009536743)
                 {
                     this._stick    = 1f;
                     this._incStage = true;
                     this._done     = true;
                 }
             }
         }
         else if (this._scanStage == 2)
         {
             Layer.basicWireframeEffect.effect.Parameters["screenCross"].SetValue(0.0f);
             if (Layer.basicWireframeTex)
             {
                 Layer.basicWireframeEffect.effect.Parameters["scanMul"].SetValue(0.0f);
             }
             this._stick = Lerp.Float(this._stick, 0.0f, amount2);
             if ((double)this._stick < 0.00999999977648258)
             {
                 this._stick    = 0.0f;
                 this._decStage = true;
             }
         }
         else if (this._scanStage == 1)
         {
             this._stick = Lerp.Float(this._stick, 1f, amount2);
             if ((double)this._stick > 0.990000009536743)
             {
                 this._stick    = 1f;
                 this._decStage = true;
             }
         }
         else if (this._scanStage == 0)
         {
             this._stick = Lerp.Float(this._stick, 0.0f, amount2);
             if ((double)this._stick < 0.00999999977648258)
             {
                 this._stick    = 0.0f;
                 this._decStage = true;
                 this._done     = true;
             }
         }
         if (this._incStage)
         {
             this._incStage = false;
             ++this._scanStage;
         }
         if (this._decStage)
         {
             this._decStage = false;
             --this._scanStage;
         }
         if (this._scanStage < 2)
         {
             Layer.doVirtualEffect   = true;
             Layer.basicWireframeTex = this._scanStage == 1;
             Layer.basicWireframeEffect.effect.Parameters["screenCross"].SetValue(this._stick);
             if (Layer.basicWireframeTex)
             {
                 Layer.basicWireframeEffect.effect.Parameters["scanMul"].SetValue(1f);
             }
         }
         this._fullyVirtual    = false;
         this._fullyNonVirtual = false;
         if (this._scanStage == 3)
         {
             this._fullyNonVirtual = true;
         }
         else if (this._scanStage == -1)
         {
             this._fullyVirtual = true;
         }
         this._lastCameraX = Level.activeLevel.camera.centerX;
         if ((double)this._scissor.width == 0.0)
         {
             return;
         }
         this._parallax.scissor = this._scissor;
     }
 }
Example #13
0
        public override void Draw()
        {
            if (this.open)
            {
                this.scrollBarTop              = (int)((double)this._box.y - (double)this._box.halfHeight + 1.0 + 16.0);
                this.scrollBarBottom           = (int)((double)this._box.y + (double)this._box.halfHeight - 1.0 - 16.0);
                this.scrollBarScrollableHeight = this.scrollBarBottom - this.scrollBarTop;
                if (this.fixView)
                {
                    Layer.HUD.camera.width  *= 2f;
                    Layer.HUD.camera.height *= 2f;
                    this.fixView             = false;
                }
                DuckGame.Graphics.DrawRect(new Vec2(this._box.x - this._box.halfWidth, this._box.y - this._box.halfHeight), new Vec2((float)((double)this._box.x + (double)this._box.halfWidth - 12.0 - 2.0), this._box.y + this._box.halfHeight), Color.Black, new Depth(0.4f));
                DuckGame.Graphics.DrawRect(new Vec2((float)((double)this._box.x + (double)this._box.halfWidth - 12.0), this._box.y - this._box.halfHeight), new Vec2(this._box.x + this._box.halfWidth, this._box.y + this._box.halfHeight), Color.Black, new Depth(0.4f));
                Rectangle r = this.ScrollBarBox();
                DuckGame.Graphics.DrawRect(r, this._draggingScrollbar || r.Contains(Mouse.position) ? Color.LightGray : Color.Gray, new Depth(0.5f));
                for (int index1 = 0; index1 < this._maxModsToShow; ++index1)
                {
                    int index2 = this._scrollItemOffset + index1;
                    if (index2 < this._mods.Count)
                    {
                        float x = this._box.x - this._box.halfWidth;
                        float y = this._box.y - this._box.halfHeight + (float)(36 * index1);
                        if (this._transferItem == null && this._hoverIndex == index2)
                        {
                            DuckGame.Graphics.DrawRect(new Vec2(x, y), new Vec2((float)((double)x + (double)this._box.width - 14.0), y + 36f), Color.White * 0.6f, new Depth(0.4f));
                        }
                        else if ((index2 & 1) != 0)
                        {
                            DuckGame.Graphics.DrawRect(new Vec2(x, y), new Vec2((float)((double)x + (double)this._box.width - 14.0), y + 36f), Color.White * 0.1f, new Depth(0.4f));
                        }
                        Mod mod = this._mods[index2];
                        if (mod != null)
                        {
                            Tex2D previewTexture = mod.previewTexture;
                            if (this._noImage.texture != previewTexture)
                            {
                                this._noImage.texture = previewTexture;
                                this._noImage.scale   = new Vec2(32f / (float)previewTexture.width);
                            }
                            DuckGame.Graphics.DrawRect(new Vec2(x + 2f, y + 2f), new Vec2((float)((double)x + 36.0 - 2.0), (float)((double)y + 36.0 - 2.0)), Color.Gray, new Depth(0.5f), false, 2f);
                            DuckGame.Graphics.Draw(this._noImage, x + 2f, y + 2f, new Depth(0.5f));
                            string str = "#" + (object)(index2 + 1) + ": ";
                            string text;
                            if (!mod.configuration.loaded)
                            {
                                text = str + mod.configuration.name;
                            }
                            else
                            {
                                text = str + mod.configuration.displayName + "|WHITE| v" + mod.configuration.version.ToString() + " by |PURPLE|" + mod.configuration.author;
                            }
                            this._fancyFont.Draw(text, new Vec2((float)((double)x + 36.0 + 10.0), y + 2f), Color.Yellow, new Depth(0.5f));
                            DuckGame.Graphics.Draw(!mod.configuration.isWorkshop ? (Sprite)this._localIcon : this._steamIcon, x + 36f, y + 2.5f, new Depth(0.5f));
                            if (!mod.configuration.loaded)
                            {
                                if (mod.configuration.disabled)
                                {
                                    this._fancyFont.Draw("Mod is disabled.", new Vec2(x + 36f, y + 6f + (float)this._fancyFont.characterHeight), Color.LightGray, new Depth(0.5f));
                                }
                                else
                                {
                                    this._fancyFont.Draw("|DGGREEN|Mod will be enabled on next restart.", new Vec2(x + 36f, y + 6f + (float)this._fancyFont.characterHeight), Color.Orange, new Depth(0.5f));
                                }
                            }
                            else if (mod.configuration.disabled)
                            {
                                this._fancyFont.Draw("|DGRED|Mod will be disabled on next restart.", new Vec2(x + 36f, y + 6f + (float)this._fancyFont.characterHeight), Color.Orange, new Depth(0.5f));
                            }
                            else
                            {
                                this._fancyFont.Draw(mod.configuration.description, new Vec2(x + 36f, y + 6f + (float)this._fancyFont.characterHeight), Color.White, new Depth(0.5f));
                            }
                        }
                        else
                        {
                            DuckGame.Graphics.Draw((Sprite)this._newIcon, x + 2f, y + 1f, new Depth(0.5f));
                            this._fancyFont.scale = new Vec2(1.5f);
                            this._fancyFont.Draw("Get " + (this._mods.Count == 1 ? "some" : "more") + " mods!", new Vec2(x + 36f, y + 11f), Color.White, new Depth(0.5f));
                            this._fancyFont.scale = new Vec2(1f);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                if (this._awaitingChanges)
                {
                    DuckGame.Graphics.DrawString("Restart required for some changes to take effect!", new Vec2((float)((double)this.x - (double)this.halfWidth + 128.0), (float)((double)this.y - (double)this.halfHeight + 8.0)), Color.Red, new Depth(0.6f));
                }
                if (this._transferItem != null)
                {
                    DuckGame.Graphics.DrawRect(new Rectangle(this._box.x - this._box.halfWidth, this._box.y - this._box.halfHeight, this._box.width, this._box.height), Color.Black * 0.9f, new Depth(0.7f));
                    string text = "Creating item...";
                    if (this._transferring)
                    {
                        TransferProgress uploadProgress = this._transferItem.GetUploadProgress();
                        string           str;
                        switch (uploadProgress.status)
                        {
                        case ItemUpdateStatus.PreparingConfig:
                            str = "Preparing config";
                            break;

                        case ItemUpdateStatus.PreparingContent:
                            str = "Preparing content";
                            break;

                        case ItemUpdateStatus.UploadingContent:
                            str = "Uploading content";
                            break;

                        case ItemUpdateStatus.UploadingPreviewFile:
                            str = "Uploading preview";
                            break;

                        case ItemUpdateStatus.CommittingChanges:
                            str = "Committing changes";
                            break;

                        default:
                            str = "Waiting";
                            break;
                        }
                        if (uploadProgress.bytesTotal != 0UL)
                        {
                            float amount = (float)uploadProgress.bytesDownloaded / (float)uploadProgress.bytesTotal;
                            str = str + " (" + (object)(int)((double)amount * 100.0) + "%)";
                            DuckGame.Graphics.DrawRect(new Rectangle((float)((double)this._box.x - (double)this._box.halfWidth + 8.0), this._box.y - 8f, this._box.width - 16f, 16f), Color.LightGray, new Depth(0.8f));
                            DuckGame.Graphics.DrawRect(new Rectangle((float)((double)this._box.x - (double)this._box.halfWidth + 8.0), this._box.y - 8f, Lerp.FloatSmooth(0.0f, this._box.width - 16f, amount), 16f), Color.Green, new Depth(0.8f));
                        }
                        text = str + "...";
                    }
                    else if (this._needsUpdateNotes)
                    {
                        DuckGame.Graphics.DrawRect(new Rectangle(this._updateTextBox.position.x - 1f, this._updateTextBox.position.y - 1f, this._updateTextBox.size.x + 2f, this._updateTextBox.size.y + 2f), Color.Gray, new Depth(0.85f), false);
                        DuckGame.Graphics.DrawRect(new Rectangle(this._updateTextBox.position.x, this._updateTextBox.position.y, this._updateTextBox.size.x, this._updateTextBox.size.y), Color.Black, new Depth(0.85f));
                        this._updateTextBox.Draw();
                        text = "Enter change notes:";
                        DuckGame.Graphics.DrawString(this._updateButtonText, new Vec2(this._updateButton.x, this._updateButton.y), this._updateButton.Contains(Mouse.position) ? Color.Yellow : Color.White, new Depth(0.9f), scale: 2f);
                    }
                    float stringWidth = DuckGame.Graphics.GetStringWidth(text, scale: 2f);
                    DuckGame.Graphics.DrawString(text, new Vec2(this._box.x - stringWidth / 2f, (float)((double)this._box.y - (double)this._box.halfHeight + 24.0)), Color.White, new Depth(0.8f), scale: 2f);
                }
                if (Mouse.available && !this._gamepadMode)
                {
                    this._cursor.depth    = new Depth(1f);
                    this._cursor.scale    = new Vec2(1f, 1f);
                    this._cursor.position = Mouse.position;
                    this._cursor.frame    = 0;
                    if (Editor.hoverTextBox)
                    {
                        this._cursor.frame       = 5;
                        this._cursor.position.y -= 4f;
                        this._cursor.scale       = new Vec2(0.5f, 1f);
                    }
                    this._cursor.Draw();
                }
            }
            base.Draw();
        }
Example #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();
 }
Example #15
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 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();
 }
 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();
 }
Example #18
0
        public override void Update()
        {
            this._selectBeam.color = new Color(0.5f, (float)(0.200000002980232 + (double)this._wave2.normalized * 0.200000002980232), (float)(0.300000011920929 + (double)this._wave.normalized * 0.300000011920929)) * (1f + this._flash);
            this._flash            = Maths.CountDown(this._flash, 0.1f);
            this._spawnWait       -= 0.025f;
            if ((double)this._spawnWait < 0.0)
            {
                Level.Add((Thing) new MultiBeamParticle(this.x, this.y + 190f, -0.8f - this._wave.normalized, false, Color.Cyan * 0.8f));
                Level.Add((Thing) new MultiBeamParticle(this.x, this.y + 190f, -0.8f - this._wave2.normalized, true, Color.LightBlue * 0.8f));
                this._spawnWait = 1f;
            }
            using (IEnumerator <Duck> enumerator = Level.CheckRectAll <Duck>(this.position - this.center, this.position - this.center + new Vec2(this._collisionSize.x, this._collisionSize.y)).GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    Duck d = enumerator.Current;
                    if (!this._ducks.Any <BeamDuck>((Func <BeamDuck, bool>)(t => t.duck == d)))
                    {
                        float num = (double)d.y >= 100.0 ? 130f : 40f;
                        SFX.Play("stepInBeam");
                        d.immobilized = true;
                        d.crouch      = false;
                        d.sliding     = false;
                        if (d.holdObject != null)
                        {
                            this._guns.Add((Thing)d.holdObject);
                        }
                        d.ThrowItem();
                        d.solid    = false;
                        d.grounded = false;
                        this._ducks.Add(new BeamDuck()
                        {
                            duck        = d,
                            entryHeight = num,
                            leaving     = false,
                            entryDir    = (double)d.x < (double)this.x ? -1 : 1,
                            sin         = new SinWave(0.1f),
                            sin2        = new SinWave(0.05f)
                        });
                        this.entered = true;
                    }
                }
            }
            foreach (Holdable holdable in Level.CheckRectAll <Holdable>(this.position - this.center, this.position - this.center + new Vec2(this._collisionSize.x, this._collisionSize.y)))
            {
                if (holdable.owner == null && !this._guns.Contains((Thing)holdable))
                {
                    this._guns.Add((Thing)holdable);
                }
            }
            int   count = this._ducks.Count;
            int   num1  = 0;
            float num2  = 150f;
            float num3  = (float)(((double)this._beamHeight - (double)num2 * 2.0) / (count > 1 ? (double)(count - 1) : 1.0));

            for (int index = 0; index < this._ducks.Count; ++index)
            {
                BeamDuck duck = this._ducks[index];
                if (duck.leaving)
                {
                    duck.duck.solid  = true;
                    duck.duck.hSpeed = this._leaveLeft ? -4f : 4f;
                    duck.duck.vSpeed = 0.0f;
                    if ((double)Math.Abs(duck.duck.position.x - this.x) > 24.0)
                    {
                        duck.duck.immobilized = false;
                        this._ducks.RemoveAt(index);
                        --index;
                        continue;
                    }
                }
                else
                {
                    duck.duck.position.x = Lerp.FloatSmooth(duck.duck.position.x, this.position.x + (float)duck.sin2 * 1f, 0.2f);
                    duck.duck.position.y = Lerp.FloatSmooth(duck.duck.position.y, (float)((double)num2 + (double)num3 * (double)index + (double)(float)duck.sin * 2.0), 0.08f);
                    duck.duck.vSpeed     = 0.0f;
                    duck.duck.hSpeed     = 0.0f;
                }
                if (!TitleScreen.hasMenusOpen && duck.duck.inputProfile.Pressed("LEFT"))
                {
                    duck.leaving     = true;
                    this._leaveLeft  = true;
                    duck.duck.offDir = (sbyte)-1;
                    this.entered     = false;
                }
                ++num1;
            }
            for (int index = 0; index < this._guns.Count; ++index)
            {
                Thing gun = this._guns[index];
                gun.vSpeed = 0.0f;
                gun.hSpeed = 0.0f;
                if ((double)Math.Abs(this.position.x - gun.position.x) < 6.0)
                {
                    gun.position = Vec2.Lerp(gun.position, new Vec2(this.position.x, gun.position.y - 3f), 0.1f);
                    gun.alpha    = Maths.LerpTowards(gun.alpha, 0.0f, 0.1f);
                    if ((double)gun.alpha <= 0.0)
                    {
                        gun.y = -200f;
                        this._guns.RemoveAt(index);
                        --index;
                    }
                }
                else
                {
                    gun.position = Vec2.Lerp(gun.position, new Vec2(this.position.x, gun.position.y), 0.2f);
                }
            }
            base.Update();
        }
        public override void Update()
        {
            this._selectBeam.color = new Color(0.3f, (float)(0.300000011920929 + (double)this._wave2.normalized * 0.200000002980232), (float)(0.5 + (double)this._wave.normalized * 0.300000011920929)) * (1f + this._flash);
            this._flash            = Maths.CountDown(this._flash, 0.1f);
            this._spawnWait       -= 0.1f;
            if ((double)this._spawnWait < 0.0)
            {
                Level.Add((Thing) new BeamParticle(this.x, this.y + 190f, -0.8f - this._wave.normalized, false, Color.Cyan * 0.8f));
                Level.Add((Thing) new BeamParticle(this.x, this.y + 190f, -0.8f - this._wave2.normalized, true, Color.LightBlue * 0.8f));
                this._spawnWait = 1f;
            }
            foreach (Duck d in Level.CheckRectAll <Duck>(this.topLeft, this.bottomRight))
            {
                if (d.isServerForObject)
                {
                    this.TakeDuck(d);
                }
            }
            foreach (Holdable holdable in Level.CheckRectAll <Holdable>(this.topLeft, this.bottomRight))
            {
                if (holdable.isServerForObject)
                {
                    if (holdable is RagdollPart)
                    {
                        Duck captureDuck = (holdable as RagdollPart).doll.captureDuck;
                        if (captureDuck != null)
                        {
                            (holdable as RagdollPart).doll.Unragdoll();
                            this.TakeDuck(captureDuck);
                        }
                    }
                    else if (holdable.owner == null && !this._guns.Contains((Thing)holdable))
                    {
                        this._guns.Add((Thing)holdable);
                    }
                }
            }
            int   count = this._ducks.Count;
            int   num1  = 0;
            float num2  = (float)((double)this._beamHeight / (double)count / 2.0 + 20.0 * (count > 1 ? 1.0 : 0.0));
            float num3  = (float)(((double)this._beamHeight - (double)num2 * 2.0) / (count > 1 ? (double)(count - 1) : 1.0));

            for (int index = 0; index < this._ducks.Count; ++index)
            {
                BeamDuck duck = this._ducks[index];
                if (duck.leaving)
                {
                    duck.duck.solid  = true;
                    duck.duck.y      = MathHelper.Lerp(duck.duck.position.y, duck.entryHeight, 0.35f);
                    duck.duck.vSpeed = 0.0f;
                    if ((double)Math.Abs(duck.duck.position.y - duck.entryHeight) < 4.0)
                    {
                        duck.duck.position.y = duck.entryHeight;
                        duck.duck.hSpeed     = (float)duck.entryDir * 3f;
                        duck.duck.vSpeed     = 0.0f;
                    }
                    if ((double)Math.Abs(duck.duck.position.x - this.x) > 24.0)
                    {
                        duck.duck.gravMultiplier = 1f;
                        duck.duck.immobilized    = false;
                        duck.duck.beammode       = false;
                        this._ducks.RemoveAt(index);
                        --index;
                        continue;
                    }
                }
                else
                {
                    duck.duck.position.x     = Lerp.FloatSmooth(duck.duck.position.x, this.position.x + (float)duck.sin2 * 1f, 0.4f);
                    duck.duck.position.y     = Lerp.FloatSmooth(duck.duck.position.y, (float)((double)num2 + (double)num3 * (double)index + (double)(float)duck.sin * 2.0), 0.1f);
                    duck.duck.vSpeed         = 0.0f;
                    duck.duck.hSpeed         = 0.0f;
                    duck.duck.gravMultiplier = 0.0f;
                }
                if (duck.duck.inputProfile.Pressed("QUACK") && (double)Math.Abs(duck.duck.position.x - this.x) < 2.0)
                {
                    duck.leaving = true;
                }
                ++num1;
            }
            for (int index = 0; index < this._guns.Count; ++index)
            {
                Thing gun = this._guns[index];
                gun.vSpeed = 0.0f;
                gun.hSpeed = 0.0f;
                if ((double)Math.Abs(this.position.x - gun.position.x) < 6.0)
                {
                    gun.position = Vec2.Lerp(gun.position, new Vec2(this.position.x, gun.position.y - 3f), 0.1f);
                    gun.alpha    = Maths.LerpTowards(gun.alpha, 0.0f, 0.1f);
                    if ((double)gun.alpha <= 0.0)
                    {
                        gun.y = -200f;
                        this._guns.RemoveAt(index);
                        --index;
                    }
                }
                else
                {
                    gun.position = Vec2.Lerp(gun.position, new Vec2(this.position.x, gun.position.y), 0.2f);
                }
            }
            base.Update();
        }