Esempio n. 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));
                }
            }
        }
Esempio n. 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;
        }
Esempio n. 3
0
 public override void LoadContent()
 {
     if (canRunContent)
     {
         delayer = new ActionDelayer();
         ComputerLoader.init(this);
         content = ScreenManager.Game.Content;
         username = SaveUserAccountName == null
             ? (Settings.isConventionDemo ? Settings.ConventionLoginName : Environment.UserName)
             : SaveUserAccountName;
         username = FileSanitiser.purifyStringForDisplay(username);
         var compLocation = new Vector2(0.1f, 0.5f);
         if (multiplayer && !isServer)
             compLocation = new Vector2(0.8f, 0.8f);
         ramAvaliable = totalRam;
         var str = !multiplayer || !isServer ? NetworkMap.generateRandomIP() : NetworkMap.generateRandomIP();
         thisComputer = new Computer(username + " PC", NetworkMap.generateRandomIP(), compLocation, 5, 4, this);
         thisComputer.adminIP = thisComputer.ip;
         thisComputer.idName = "playerComp";
         var folder = thisComputer.files.root.searchForFolder("home");
         folder.folders.Add(new Folder("stash"));
         folder.folders.Add(new Folder("misc"));
         var userDetail = thisComputer.users[0];
         userDetail.known = true;
         thisComputer.users[0] = userDetail;
         defaultUser = new UserDetail(username, "password", 1);
         defaultUser.known = true;
         var theme = OSTheme.HacknetBlue;
         if (Settings.isConventionDemo)
         {
             var num = Utils.random.NextDouble();
             if (num < 0.33)
                 theme = OSTheme.HacknetMint;
             else if (num < 0.66)
                 theme = OSTheme.HackerGreen;
         }
         ThemeManager.setThemeOnComputer(thisComputer, theme);
         if (multiplayer)
         {
             thisComputer.addMultiplayerTargetFile();
             sendMessage("newComp #" + thisComputer.ip + "#" + compLocation.X + "#" + compLocation.Y +
                         "#" + 5 + "#" + thisComputer.name);
             multiplayerMissionLoaded = false;
         }
         if (!WillLoadSave)
             People.init();
         modules = new List<Module>();
         exes = new List<ExeModule>();
         shells = new List<ShellExe>();
         shellIPs = new List<string>();
         var viewport = ScreenManager.GraphicsDevice.Viewport;
         var width1 = RamModule.MODULE_WIDTH;
         var height1 = 205;
         var width2 = (int) ((viewport.Width - width1 - 6)*0.4442);
         var num1 = (int) ((viewport.Width - width1 - 6)*0.5558);
         var height2 = viewport.Height - height1 - TOP_BAR_HEIGHT - 6;
         terminal =
             new Terminal(
                 new Rectangle(viewport.Width - 2 - width2, TOP_BAR_HEIGHT, width2,
                     viewport.Height - TOP_BAR_HEIGHT - 2), this);
         terminal.name = "TERMINAL";
         modules.Add(terminal);
         netMap = new NetworkMap(new Rectangle(width1 + 4, viewport.Height - height1 - 2, num1 - 1, height1),
             this);
         netMap.name = "netMap v1.7";
         modules.Add(netMap);
         display = new DisplayModule(new Rectangle(width1 + 4, TOP_BAR_HEIGHT, num1 - 2, height2), this);
         display.name = "DISPLAY";
         modules.Add(display);
         ram =
             new RamModule(
                 new Rectangle(2, TOP_BAR_HEIGHT, width1, ramAvaliable + RamModule.contentStartOffset), this);
         ram.name = "RAM";
         modules.Add(ram);
         for (var index = 0; index < modules.Count; ++index)
             modules[index].LoadContent();
         for (var index = 0; index < 2; ++index)
         {
             if (isServer || !multiplayer)
                 thisComputer.links.Add(index);
             else
                 thisComputer.links.Add(netMap.nodes.Count - 1 - index);
         }
         var flag1 = false;
         if (!WillLoadSave)
         {
             netMap.nodes.Insert(0, thisComputer);
             netMap.visibleNodes.Add(0);
             MusicManager.loadAsCurrentSong("Music\\Revolve");
         }
         else
         {
             loadSaveFile();
             flag1 = true;
             Settings.initShowsTutorial = false;
         }
         if (!multiplayer && !flag1)
         {
             MailServer.shouldGenerateJunk = false;
             netMap.mailServer.addNewUser(thisComputer.ip, defaultUser);
         }
         mailicon = new MailIcon(this, new Vector2(0.0f, 0.0f));
         mailicon.pos.X = viewport.Width - mailicon.getWidth() - 2;
         topBar = new Rectangle(0, 0, viewport.Width, TOP_BAR_HEIGHT - 1);
         crashModule =
             new CrashModule(
                 new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                     ScreenManager.GraphicsDevice.Viewport.Height), this);
         crashModule.LoadContent();
         introTextModule =
             new IntroTextModule(
                 new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                     ScreenManager.GraphicsDevice.Viewport.Height), this);
         introTextModule.LoadContent();
         traceTracker = new TraceTracker(this);
         IncConnectionOverlay = new IncomingConnectionOverlay(this);
         if (allFactions == null)
         {
             allFactions = new AllFactions();
             allFactions.init();
         }
         currentFaction = allFactions.factions[allFactions.currentFaction];
         scanLines = content.Load<Texture2D>("ScanLines");
         cross = content.Load<Texture2D>("Cross");
         cog = content.Load<Texture2D>("Cog");
         saveIcon = content.Load<Texture2D>("SaveIcon");
         beepSound = content.Load<SoundEffect>("SFX/beep");
         if (!multiplayer & !flag1)
             loadMissionNodes();
         if (!flag1)
             MusicManager.playSong();
         if (flag1 || !Settings.slowOSStartup)
         {
             initShowsTutorial = false;
             introTextModule.complete = true;
         }
         inputEnabled = true;
         isLoaded = true;
         fullscreen = new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
             ScreenManager.GraphicsDevice.Viewport.Height);
         TraceDangerSequence = new TraceDangerSequence(content, ScreenManager.SpriteBatch, fullscreen, this);
         endingSequence = new EndingSequenceModule(fullscreen, this);
         var flag2 = Settings.slowOSStartup && !flag1;
         var flag3 = Settings.osStartsWithTutorial && (!flag1 || !Flags.HasFlag("TutorialComplete"));
         if (flag2)
         {
             rebootThisComputer();
             if (!Settings.initShowsTutorial)
                 return;
             display.visible = false;
             ram.visible = false;
             netMap.visible = false;
             terminal.visible = true;
         }
         else if (flag3)
         {
             display.visible = false;
             ram.visible = false;
             netMap.visible = false;
             terminal.visible = true;
             terminal.reset();
             Settings.initShowsTutorial = true;
             initShowsTutorial = true;
             if (TestingPassOnly)
                 return;
             execute("FirstTimeInitdswhupwnemfdsiuoewnmdsmffdjsklanfeebfjkalnbmsdakj Init");
         }
         else
         {
             if (!TestingPassOnly)
                 runCommand("connect " + thisComputer.ip);
             if (thisComputer.files.root.searchForFolder("sys").searchForFile("Notes_Reopener.bat") == null)
                 return;
             runCommand("notes");
         }
     }
     else
     {
         if (!multiplayer)
             return;
         initializeNetwork();
     }
 }