コード例 #1
0
        public void Update(float dt, object osobj)
        {
            OS os = (OS)osobj;

            if ((double)this.themeSwapTimeRemaining > 0.0)
            {
                this.themeSwapTimeRemaining -= dt;
                if ((double)this.themeSwapTimeRemaining <= 0.0)
                {
                    this.CompleteThemeSwap((object)os);
                    return;
                }
                bool    flag            = (double)Utils.randm(1f) > (double)this.themeSwapTimeRemaining / (double)this.originalThemeSwapTime;
                OSTheme theme           = flag ? this.newTheme : this.oldTheme;
                string  customThemePath = flag ? this.newThemePath : this.oldThemePath;
                ThemeManager.LastLoadedCustomTheme = flag ? this.newCustomTheme : this.oldCustomTheme;
                if (customThemePath != null)
                {
                    ThemeManager.switchTheme((object)os, customThemePath);
                }
                else
                {
                    ThemeManager.switchTheme((object)os, theme);
                }
            }
            if (this.ScreenBleedActive)
            {
                this.ScreenBleedTimeLeft -= dt;
                PostProcessor.dangerModePercentComplete = Math.Max(0.0f, Math.Min((float)(1.0 - (double)this.ScreenBleedTimeLeft / (double)this.ScreenBleedStartTime), 1f));
                PostProcessor.dangerModeEnabled         = true;
                if ((double)this.ScreenBleedTimeLeft <= 0.0)
                {
                    this.ScreenBleedActive = false;
                    PostProcessor.dangerModePercentComplete = 0.0f;
                    PostProcessor.dangerModeEnabled         = false;
                    if (!string.IsNullOrWhiteSpace(this.screenBleedCompleteAction))
                    {
                        RunnableConditionalActions.LoadIntoOS(this.screenBleedCompleteAction, (object)os);
                    }
                }
                else
                {
                    os.postFXDrawActions += (Action)(() => TraceDangerSequence.DrawCountdownOverlay(Utils.CheckStringIsTitleRenderable(this.screenBleedTitle) ? GuiData.titlefont : GuiData.font, GuiData.smallfont, (object)os, this.screenBleedTitle, this.screenBleedL1, this.screenBleedL2, this.screenBleedL3));
                }
            }
        }
コード例 #2
0
        public void Draw()
        {
            bool drawShadow = TextItem.DrawShadow;

            TextItem.DrawShadow = false;
            switch (this.state)
            {
            case TraceDangerSequence.TraceDangerState.WarningScrenIntro:
                this.DrawFlashingRedBackground();
                Rectangle destinationRectangle1 = new Rectangle(10, this.fullscreen.Height / 2 - 2, this.fullscreen.Width - 20, 4);
                this.spriteBatch.Draw(Utils.white, destinationRectangle1, Color.Black);
                destinationRectangle1.Width = (int)((double)destinationRectangle1.Width * (1.0 - (double)this.percentComplete));
                this.spriteBatch.Draw(Utils.white, destinationRectangle1, Color.Red);
                break;

            case TraceDangerSequence.TraceDangerState.WarningScreen:
                this.DrawWarningScreen();
                break;

            case TraceDangerSequence.TraceDangerState.WarningScreenExiting:
                this.DrawFlashingRedBackground();
                Rectangle destinationRectangle2 = new Rectangle(10, this.fullscreen.Height / 2 - 2, this.fullscreen.Width - 20, 4);
                if ((double)this.percentComplete > 0.5)
                {
                    int num = (int)((double)((float)this.os.fullscreen.Height * 0.7f) * (double)Utils.QuadraticOutCurve((float)(((double)this.percentComplete - 0.5) * 2.0)));
                    destinationRectangle2.Y      = this.fullscreen.Height / 2 - 2 - num / 2;
                    destinationRectangle2.Height = num;
                }
                this.spriteBatch.Draw(Utils.white, destinationRectangle2, Color.Black);
                destinationRectangle2.Width = (int)((double)destinationRectangle2.Width * (double)Math.Min(1f, Utils.QuadraticOutCurve(this.percentComplete * 2f)));
                this.spriteBatch.Draw(Utils.white, destinationRectangle2, Color.DarkRed);
                float num1 = Utils.QuadraticOutCurve((float)(((double)this.percentComplete - 0.5) * 2.0));
                if ((double)this.percentComplete > 0.5)
                {
                    new ThinBarcode(destinationRectangle2.Width, destinationRectangle2.Height).Draw(this.spriteBatch, destinationRectangle2.X, destinationRectangle2.Y, (double)Utils.randm(1f) > (double)num1 ? Color.Black : ((double)Utils.randm(1f) <= (double)num1 || (double)Utils.randm(1f) <= 0.800000011920929 ? Utils.VeryDarkGray : Utils.AddativeWhite));
                }
                TextItem.doFontLabel(new Vector2((float)(this.fullscreen.Width / 2 - 250), (float)(destinationRectangle2.Y - 70)), "INITIALIZING FAILSAFE", GuiData.titlefont, new Color?(Color.White), 500f, 70f, false);
                break;

            case TraceDangerSequence.TraceDangerState.Countdown:
                this.PreventOSRendering = false;
                float num2 = this.timeThisState * 0.5f;
                if ((double)num2 < 1.0)
                {
                    this.os.display.visible  = (double)num2 > (double)Utils.randm(1f);
                    this.os.netMap.visible   = (double)num2 > (double)Utils.randm(1f);
                    this.os.terminal.visible = (double)num2 > (double)Utils.randm(1f);
                    this.os.ram.visible      = (double)num2 > (double)Utils.randm(1f);
                }
                else
                {
                    this.os.display.visible  = true;
                    this.os.netMap.visible   = true;
                    this.os.terminal.visible = true;
                    this.os.ram.visible      = true;
                }
                TraceDangerSequence.DrawCountdownOverlay(this.titleFont, this.bodyFont, (object)this.os, (string)null, (string)null, (string)null, (string)null);
                break;

            case TraceDangerSequence.TraceDangerState.DisconnectedReboot:
                this.DrawDisconnectedScreen();
                break;
            }
            TextItem.DrawShadow = drawShadow;
        }