public UIUnlockBox(List <Unlockable> unlocks, float xpos, float ypos, float wide = -1f, float high = -1f) : base("", xpos, ypos, wide, high) { Graphics.fade = 1f; this._frame = new Sprite("unlockFrame"); this._frame.CenterOrigin(); this._wrappedFrame = new Sprite("unlockFrameWrapped"); this._wrappedFrame.CenterOrigin(); this._font = new BitmapFont("biosFontUI", 8, 7); this._fancyFont = new FancyBitmapFont("smallFont"); this._unlocks = unlocks; this._unlock = this._unlocks.First <Unlockable>(); }
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(); }