Ejemplo n.º 1
0
 public void ResetForLogin()
 {
     this.promptIndex = 0;
     this.IsReady     = false;
     this.PromptSequence.Clear();
     this.PromptSequence.Add(LocaleTerms.Loc("USERNAME") + " :");
     this.PromptSequence.Add(LocaleTerms.Loc("PASSWORD") + " :");
     this.History.Clear();
     this.History.Add("-- Login --");
     this.currentPrompt     = this.PromptSequence[this.promptIndex];
     this.IsNewAccountMode  = false;
     this.terminalString    = "";
     TextBox.cursorPosition = 0;
 }
Ejemplo n.º 2
0
        private void SendAssetAddedNotification(object osIn)
        {
            OS       os       = (OS)osIn;
            string   subject  = this.name + " " + LocaleTerms.Loc("Admins :: New asset added");
            string   body     = string.Format(Utils.readEntireFile("Content/LocPost/CSEC_ThemechangerEmail.txt"), (object)this.name);
            string   sender   = this.name + " ReplyBot";
            Computer computer = Programs.getComputer(os, "mainHubAssets");
            string   str      = "link#%#" + computer.name + "#%#" + computer.ip;
            string   email    = MailServer.generateEmail(subject, body, sender, new List <string>((IEnumerable <string>) new string[1] {
                str
            }));

            ((MailServer)os.netMap.mailServer.getDaemon(typeof(MailServer))).addMail(email, os.defaultUser.name);
        }
Ejemplo n.º 3
0
 public void ResetForNewAccount()
 {
     this.promptIndex = 0;
     this.IsReady     = false;
     this.PromptSequence.Clear();
     this.PromptSequence.Add(LocaleTerms.Loc("USERNAME") + " :");
     this.PromptSequence.Add(LocaleTerms.Loc("PASSWORD") + " :");
     this.PromptSequence.Add(LocaleTerms.Loc("CONFIRM PASS") + " :");
     this.History.Clear();
     this.History.Add("-- " + LocaleTerms.Loc("New " + this.ProjectName + " User Registration") + " --");
     this.currentPrompt     = this.PromptSequence[this.promptIndex];
     this.IsNewAccountMode  = true;
     this.terminalString    = "";
     TextBox.cursorPosition = 0;
 }
Ejemplo n.º 4
0
        private void doEmptyModule()
        {
            this.spriteBatch.Draw(Utils.white, this.bounds, this.userScreen.displayModuleExtraLayerBackingColor);
            var tmpRect = new Rectangle();

            tmpRect.X      = this.bounds.X + 2;
            tmpRect.Width  = this.bounds.Width - 4;
            tmpRect.Y      = this.bounds.Y + this.bounds.Height / 6 * 2;
            tmpRect.Height = this.bounds.Height / 3;
            this.spriteBatch.Draw(Utils.white, tmpRect, userScreen.indentBackgroundColor);
            Vector2 vector   = GuiData.font.MeasureString(LocaleTerms.Loc("No Active Session"));
            Vector2 position = new Vector2((float)(tmpRect.X + this.bounds.Width / 2) - vector.X / 2f, (float)(this.bounds.Y + this.bounds.Height / 2 - 10));

            this.spriteBatch.DrawString(GuiData.font, LocaleTerms.Loc("No Active Session"), position, userScreen.subtleTextColor);
        }
Ejemplo n.º 5
0
 public static void ResetForLogin()
 {
     promptIndex = 0;
     IsReady     = false;
     PromptSequence.Clear();
     PromptSequence.Add(LocaleTerms.Loc("USERNAME") + " :");
     PromptSequence.Add(LocaleTerms.Loc("PASSWORD") + " :");
     History.Clear();
     History.Add("-- " + LocaleTerms.Loc("HackOnNet Login") + " --");
     currentPrompt    = PromptSequence[promptIndex];
     IsLoginMode      = true;
     PreventAdvancing = false;
     terminalString   = "";
     Hacknet.Gui.TextBox.cursorPosition = 0;
 }
Ejemplo n.º 6
0
        private void DrawDisconnectedScreen()
        {
            this.spriteBatch.Draw(Utils.white, this.fullscreen, Color.Black);
            Rectangle destinationRectangle = new Rectangle();

            destinationRectangle.X      = this.fullscreen.X + 2;
            destinationRectangle.Width  = this.fullscreen.Width - 4;
            destinationRectangle.Y      = this.fullscreen.Y + this.fullscreen.Height / 6 * 2;
            destinationRectangle.Height = this.fullscreen.Height / 3;
            this.spriteBatch.Draw(Utils.white, destinationRectangle, this.os.indentBackgroundColor);
            Vector2 vector2  = GuiData.titlefont.MeasureString("DISCONNECTED");
            Vector2 position = new Vector2((float)(destinationRectangle.X + this.fullscreen.Width / 2) - vector2.X / 2f, (float)(this.fullscreen.Y + this.fullscreen.Height / 2 - 50));

            this.spriteBatch.DrawString(GuiData.titlefont, "DISCONNECTED", position, this.os.subtleTextColor);
            this.DrawFlashInString(LocaleTerms.Loc("Rebooting"), this.DrawFlashInString(LocaleTerms.Loc("Preparing for system reboot"), this.DrawFlashInString(LocaleTerms.Loc("Foreign trace averted"), this.DrawFlashInString(LocaleTerms.Loc("IP Address successfully reset"), new Vector2(200f, (float)(destinationRectangle.Y + destinationRectangle.Height + 20)), 4f, 0.2f, true, 0.2f), 5f, 0.2f, true, 0.2f), 6f, 0.2f, true, 0.8f), 9f, 0.2f, true, 0.2f);
        }
Ejemplo n.º 7
0
 public void ForceStartBitMissions(object os)
 {
     ((OS)os).Flags.AddFlag("bitPathStarted");
     ((OS)os).delayer.Post(ActionDelayer.Wait(1.6), (Action)(() => ComputerLoader.loadMission("Content/Missions/BitPath/BitAdv_Intro.xml", false)));
     Programs.getComputer((OS)os, "mainHubAssets").files.root.searchForFolder("bin").folders.Add(new Folder("Misc")
     {
         files =
         {
             new FileEntry(PortExploits.crackExeData[9],                           "Decypher.exe"),
             new FileEntry(PortExploits.crackExeData[10],                          "DECHead.exe"),
             new FileEntry(PortExploits.crackExeData[104],                         "KBT_PortTest.exe"),
             new FileEntry("Kellis BioTech medical port cycler - target 104-103.", "kbt_readme.txt")
         }
     });
     this.SendNotification(os, LocaleTerms.Loc("Agent") + ",\n" + LocaleTerms.Loc("Additional resources have been added to the CSEC members asset pool, for your free use.") + " " + LocaleTerms.Loc("Find them in the misc folder on the asset server.") + "\n\n" + LocaleTerms.Loc("Thankyou") + ",\n -" + this.name, this.name + " " + LocaleTerms.Loc("Admins :: Asset Uploads"));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Retrieves the localized formatted (based on the extra arguments) string of the input along.
 /// </summary>
 /// <returns>The localized formatted string of the input, otherwise defaulting to LocaleTerms.Loc.</returns>
 /// <param name="input">The input string to search in the locale for.</param>
 /// <param name="extraArgs">Any extra formatting arguments.</param>
 public static string Get(string input, params object[] extraArgs)
 {
     if (StoredLocale.ContainsKey(input))
     {
         var result = StoredLocale[input];
         if (extraArgs != null && extraArgs.Length > 0)
         {
             try
             {
                 return(string.Format(result, extraArgs));
             }
             catch (FormatException) {}
         }
         return(result);
     }
     return(LocaleTerms.Loc(input));
 }
Ejemplo n.º 9
0
 private Vector2 DrawExtensionList(Vector2 drawpos, Rectangle dest, SpriteBatch sb)
 {
     if (this.HasLoaded)
     {
         Rectangle fullscreen = Utils.GetFullscreen();
         for (int scrollStartIndex = this.ScrollStartIndex; scrollStartIndex <= this.Extensions.Count; ++scrollStartIndex)
         {
             if ((double)drawpos.Y + 120.0 + 20.0 >= (double)fullscreen.Height || this.ScrollStartIndex > 0 && scrollStartIndex == this.Extensions.Count)
             {
                 int height = 20;
                 int num    = (50 - height * 2) / 4;
                 if (Button.doButton(790001 + scrollStartIndex, (int)drawpos.X, (int)drawpos.Y + num, 450, height, "   ^   ", new Color?(this.ScrollStartIndex > 0 ? MainMenu.buttonColor : Color.Black)) && this.ScrollStartIndex > 0)
                 {
                     --this.ScrollStartIndex;
                 }
                 bool flag = scrollStartIndex <= this.Extensions.Count - 1;
                 if (Button.doButton(790101 + scrollStartIndex + 1, (int)drawpos.X, (int)drawpos.Y + height + num + num + 2, 450, height, "   v   ", new Color?(flag ? MainMenu.buttonColor : Color.Black)) && flag)
                 {
                     ++this.ScrollStartIndex;
                 }
                 drawpos.Y += 55f;
                 break;
             }
             if (scrollStartIndex < this.Extensions.Count)
             {
                 ExtensionInfo extension = this.Extensions[scrollStartIndex];
                 if (Button.doButton(780001 + scrollStartIndex, (int)drawpos.X, (int)drawpos.Y, 450, 50, extension.Name, new Color?(Color.White)))
                 {
                     this.ActivateExtensionPage(extension);
                 }
                 drawpos.Y += 55f;
             }
         }
     }
     else
     {
         TextItem.doFontLabel(drawpos, LocaleTerms.Loc("Loading..."), GuiData.font, new Color?(Color.White), (float)dest.Width, 20f, false);
         drawpos.Y += 55f;
     }
     if (!string.IsNullOrWhiteSpace(this.LoadErrors))
     {
         TextItem.doFontLabel(drawpos + new Vector2(0.0f, 30f), this.LoadErrors, GuiData.smallfont, new Color?(Color.Red), float.MaxValue, float.MaxValue, false);
     }
     return(drawpos);
 }
Ejemplo n.º 10
0
 public static void OverridePortHack(ExecutablePortExecuteEvent e)
 {
     if (e[0].ToLower() == "porthack")
     {
         e.IsCancelled = true;
         var  os             = e.OS;
         var  cComp          = os.connectedComp;
         bool canRun         = false;
         bool firewallActive = false;
         if (cComp != null)
         {
             int num2 = 0;
             for (int i = 0; i < cComp.portsOpen.Count; i++)
             {
                 num2 += os.connectedComp.portsOpen[i];
             }
             foreach (var p in cComp.GetModdedPortList())
             {
                 num2 += p.Unlocked ? 1 : 0;
             }
             canRun |= num2 > cComp.portsNeededForCrack;
             if (cComp.firewall != null && !cComp.firewall.solved)
             {
                 firewallActive |= canRun;
                 canRun          = false;
             }
         }
         if (canRun)
         {
             os.addExe(new PortHackExe(e.Destination, os));
         }
         else if (firewallActive)
         {
             os.WriteLine("{0} -\n{1}",
                          LocaleTerms.Loc("Target Machine Rejecting Syndicated UDP Traffic"),
                          LocaleTerms.Loc("Bypass Firewall to allow unrestricted traffic"));
         }
         else
         {
             os.WriteLine("{0} - \n{1}\n",
                          LocaleTerms.Loc("Too Few Open Ports to Run"),
                          LocaleTerms.Loc("Open Additional Ports on Target Machine"));
         }
     }
 }
Ejemplo n.º 11
0
 private void AddExtensionSafe(string folderpath)
 {
     if (!ExtensionInfo.ExtensionExists(folderpath))
     {
         return;
     }
     try
     {
         this.Extensions.Add(ExtensionInfo.ReadExtensionInfo(folderpath));
     }
     catch (Exception ex)
     {
         Console.WriteLine(Utils.GenerateReportFromException(ex));
         ExtensionsMenuScreen extensionsMenuScreen = this;
         string str = extensionsMenuScreen.LoadErrors + LocaleTerms.Loc("Error loading ExtensionInfo for") + " " + folderpath + "\n" + LocaleTerms.Loc("Error details written to") + " " + folderpath.Replace("\\", "/") + "/error_report.txt\n\n";
         extensionsMenuScreen.LoadErrors = str;
         Utils.writeToFile("Error loading ExtensionInfo for extension in folder:\n" + folderpath + "\nError details: \n" + Utils.GenerateReportFromException(ex), folderpath + "/error_report.txt");
     }
 }
Ejemplo n.º 12
0
        private static void AddGameExecutable(this OS os, GameExecutable exe, Rectangle location, string[] args)
        {
            exe.Assign(location, os, args);
            var computer = os.connectedComp ?? os.thisComputer;

            try
            {
                if (exe.needsProxyAccess && computer.proxyActive)
                {
                    exe.OnProxyBypassFailure();
                    if (!exe.IgnoreProxyFailPrint)
                    {
                        os.write(LocaleTerms.Loc("Proxy Active -- Cannot Execute"));
                    }
                    return;
                }

                if (os.ramAvaliable >= exe.ramCost)
                {
                    exe.OnInitialize();
                    if (exe.CanAddToSystem)
                    {
                        os.exes.Add(exe);
                    }
                    return;
                }

                exe.OnNoAvailableRam();
                if (!exe.IgnoreMemoryBehaviorPrint)
                {
                    os.ram.FlashMemoryWarning();
                    os.write(LocaleTerms.Loc("Insufficient Memory"));
                }
            }
            catch (Exception e)
            {
                if (exe.CatchException(e))
                {
                    throw e;
                }
            }
        }
Ejemplo n.º 13
0
        private static void DrawMain(DrawMainMenuEvent e)
        {
            Rectangle dest = new Rectangle(180, 120, 340, 100);

            ResetForLogin();
            SpriteFont titleFont  = (SpriteFont)e.MainMenu.GetType().GetField("titleFont", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(e.MainMenu);
            Color      titleColor = (Color)e.MainMenu.GetType().GetField("titleColor", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(e.MainMenu);

            Hacknet.Effects.FlickeringTextEffect.DrawLinedFlickeringText(dest, "HACK ON NET", 7f, 0.55f, titleFont, null, titleColor, 2);
            Hacknet.Gui.TextItem.doFontLabel(new Vector2(520f, 178f), "Hack On Net v0.1", GuiData.smallfont, new Color?(titleColor * 0.5f), 600f, 26f, false);

            logIn.Draw();

            if (Hacknet.Gui.Button.doButton(3, 180, 305, 450, 40, LocaleTerms.Loc("Settings"), Color.LightSkyBlue))
            {
                e.MainMenu.ScreenManager.AddScreen(new OptionsMenu(), new PlayerIndex?(e.MainMenu.ScreenManager.controllingPlayer));
            }

            if (Hacknet.Gui.Button.doButton(15, 180, 360, 450, 28, LocaleTerms.Loc("Back to Main Menu"), Color.Gray))
            {
                currentState = MenuState.OG_MENU;
            }
        }
Ejemplo n.º 14
0
        public static void DrawCountdownOverlay(SpriteFont titleFont, SpriteFont bodyFont, object osobj, string title = null, string l1 = null, string l2 = null, string l3 = null)
        {
            OS os = (OS)osobj;

            if (title == null)
            {
                title = "EMERGENCY TRACE AVERSION SEQUENCE";
            }
            if (l1 == null)
            {
                l1 = LocaleTerms.Loc("Reset Assigned Ip Address on ISP Mainframe");
            }
            Computer computer = Programs.getComputer(os, "ispComp");

            if (l2 == null)
            {
                l2 = string.Format(LocaleTerms.Loc("ISP Mainframe IP: {0}"), computer != null ? (object)computer.ip : (object)"68.144.93.18");
            }
            if (l3 == null)
            {
                l3 = string.Format(LocaleTerms.Loc("YOUR Assigned IP: {0}"), (object)os.thisComputer.ip);
            }
            Rectangle fullscreen           = Utils.GetFullscreen();
            int       height               = 110;
            Rectangle destinationRectangle = new Rectangle(0, fullscreen.Height - height - 20, 520, height);

            GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Lerp(TraceDangerSequence.DarkRed, Color.Transparent, Utils.randm(0.2f)));
            Vector2 pos = new Vector2((float)(destinationRectangle.X + 6), (float)(destinationRectangle.Y + 4));

            TextItem.doFontLabel(pos, title, titleFont, new Color?(Color.White), (float)(destinationRectangle.Width - 12), 35f, false);
            pos.Y += 32f;
            TextItem.doFontLabel(pos, l1, bodyFont, new Color?(Color.White), (float)(destinationRectangle.Width - 10), 20f, false);
            pos.Y += 16f;
            TextItem.doFontLabel(pos, l2, bodyFont, new Color?(Color.White), (float)(destinationRectangle.Width - 10), 20f, false);
            pos.Y += 16f;
            TextItem.doFontLabel(pos, l3, bodyFont, new Color?(Color.White), (float)(destinationRectangle.Width - 10), 20f, false);
        }
Ejemplo n.º 15
0
        public void drawModules(GameTime gameTime)
        {
            Vector2 zero = Vector2.Zero;

            GuiData.spriteBatch.Draw(Utils.white, this.topBar, this.topBarColor);
            float t = (float)gameTime.ElapsedGameTime.TotalSeconds;

            try
            {
                Vector2 vector = GuiData.UITinyfont.MeasureString("Location: " + (activeSession == null ? "Not Connected" : activeSession.ip));
                zero.X  = (float)this.topBar.Width - vector.X /* - (float)this.mailicon.getWidth()*/;
                zero.Y -= 3f;
                GuiData.spriteBatch.DrawString(GuiData.UITinyfont, "Location: " + (activeSession == null ? "Not Connected" : activeSession.ip), zero, this.topBarTextColor);
                if (GuiData.ActiveFontConfig.tinyFontCharHeight * 2f <= (float)this.topBar.Height)
                {
                    string text = LocaleTerms.Loc("Home IP:") + " " + homeIP + " ";
                    zero.Y += (float)(this.topBar.Height / 2);
                    vector  = GuiData.UITinyfont.MeasureString(text);
                    zero.X  = (float)this.topBar.Width - vector.X /* - (float)this.mailicon.getWidth()*/;
                    GuiData.spriteBatch.DrawString(GuiData.UITinyfont, text, zero, this.topBarTextColor);
                }
                zero.Y = 0f;
            }
            catch (System.Exception)
            {
            }
            zero.X = 110f;
            if (Hacknet.Gui.Button.doButton(3827178, 3, 0, 20, this.topBar.Height - 1, "", new Color?(this.topBarIconsColor), this.cross))
            {
                this.ExitToMenuMessageBox = new MessageBoxScreen("Logout of your\nCurrent Session?" + "\n", false, true);
                this.ExitToMenuMessageBox.OverrideAcceptedText = LocaleTerms.Loc("Exit to Menu");
                this.ExitToMenuMessageBox.Accepted            += new System.EventHandler <PlayerIndexEventArgs>(this.quitGame);
                base.ScreenManager.AddScreen(this.ExitToMenuMessageBox);
            }
            else
            {
                zero.X = 2f;
            }
            zero.Y = 1f;
            string text2 = string.Concat((int)(1.0 / gameTime.ElapsedGameTime.TotalSeconds + 0.5));

            GuiData.spriteBatch.DrawString(GuiData.UITinyfont, text2, zero, this.topBarTextColor);
            zero.Y = 0f;

            //this.mailicon.Draw();

            /*int num = this.ram.bounds.Height + this.topBar.Height + 16;
             * if (num < this.fullscreen.Height && this.ram.visible)
             * {
             *  this.audioVisualizer.Draw(new Rectangle(this.ram.bounds.X, num + 1, this.ram.bounds.Width - 2, this.fullscreen.Height - num - 4), GuiData.spriteBatch);
             * }*/
            for (int i = 0; i < this.modules.Count; i++)
            {
                try
                {
                    if (this.modules[i].visible)
                    {
                        this.modules[i].PreDrawStep();
                        this.modules[i].Draw(t);
                        this.modules[i].PostDrawStep();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            /*if (this.ram.visible)
             * {
             *  for (int i = 0; i < this.exes.Count; i++)
             *  {
             *      this.exes[i].Draw(t);
             *  }
             * }*/
            //this.IncConnectionOverlay.Draw(this.fullscreen, GuiData.spriteBatch);
            //this.traceTracker.Draw(GuiData.spriteBatch);
        }
Ejemplo n.º 16
0
        private void doIRCModule()
        {
            var       sb   = spriteBatch;
            Rectangle dest = Utils.InsetRectangle(bounds, 2);
            Rectangle destinationRectangle = new Rectangle(dest.X, dest.Y - 1, 18, dest.Height + 2);

            sb.Draw(Utils.white, destinationRectangle, userScreen.moduleColorSolid);
            destinationRectangle.X     += destinationRectangle.Width / 2;
            destinationRectangle.Width /= 2;
            sb.Draw(Utils.white, destinationRectangle, Color.Black * 0.2f);
            dest.X     += 20;
            dest.Width -= 25;
            Rectangle rectangle = new Rectangle(dest.X + 4, dest.Y, dest.Width, 35);

            Hacknet.Gui.TextItem.doFontLabelToSize(rectangle, "Interweb Remote Com", GuiData.font, Color.White, true, true);
            int num  = dest.Width / 4;
            int num2 = 22;

            if (Hacknet.Gui.Button.doButton(37849102, rectangle.X + rectangle.Width - 6 - num, rectangle.Y + rectangle.Height - rectangle.Height / 2 - num2 / 2, num, num2, LocaleTerms.Loc("Exit IRC"), userScreen.moduleColorSolid))
            {
                this.userScreen.Execute("daemon exit");
                this.state = DisplayState.SSH_SESSION;
            }
            rectangle.Y     += rectangle.Height;
            rectangle.X     -= 6;
            dest.Y          += rectangle.Height;
            dest.Height     -= rectangle.Height;
            rectangle.Height = 2;
            sb.Draw(Utils.white, rectangle, userScreen.moduleColorSolid);
            dest.Y      += rectangle.Height + 2;
            dest.Height -= rectangle.Height + 2;
            dest.Height -= 6;
            PatternDrawer.draw(dest, 0.22f, Color.Black * 0.5f, /*flag ?*/ (userScreen.moduleColorSolid * 0.12f) /*: (Utils.AddativeRed * 0.2f)*/, sb, /*flag ? */ PatternDrawer.thinStripe /*: PatternDrawer.warningStripe*/);
            dest.X      += 2;
            dest.Width  -= 4;
            dest.Height -= 4;
            //if (flag)
            //{
            var messages = ((IrcState)userScreen.activeSession.GetState()).GetMessages();

            int _num  = (int)(GuiData.ActiveFontConfig.tinyFontCharHeight + 4f);
            int _num2 = 4;
            int _num3 = (int)((float)dest.Height / (float)_num);
            int _num4 = _num3;
            int _num5 = messages.Count - 1;
            int _num6 = 0;
            int y     = dest.Y;

            while (_num4 > 0 && _num5 >= 0 && dest.Height - _num6 > _num)
            {
                //bool needsNewMessagesLineDraw = this.messagesAddedSinceLastView > 0 && this.messagesAddedSinceLastView < logsFromFile.Count && logsFromFile.Count - num5 == this.messagesAddedSinceLastView;
                _num4  -= this.DrawIRCMessage(messages[_num5], dest, _num, _num4, y /*, needsNewMessagesLineDraw,*/, out dest);
                dest.Y -= _num2;
                _num6  += _num2;
                _num5--;
            }
            if (_num5 <= -1 && _num4 > 1)
            {
                int        _num7      = _num + 8;
                Rectangle  _rectangle = new Rectangle(dest.X, dest.Y + dest.Height - _num7, dest.Width, _num7);
                SpriteFont tinyfont   = GuiData.tinyfont;
                //string text = "--- " + LocaleTerms.Loc("Log Cleared by Administrator") + " ---";
                //Vector2 vector = tinyfont.MeasureString(text);
                //sb.DrawString(tinyfont, text, Utils.ClipVec2ForTextRendering(new Vector2((float)rectangle.X + (float)rectangle.Width / 2f - vector.X / 2f, (float)rectangle.Y + (float)rectangle.Height / 2f - vector.Y / 2f)), Color.Gray);
            }
            //}

            /*else
             * {
             *  int num3 = dest.Height / 4;
             *  Rectangle rectangle2 = new Rectangle(dest.X - 4, dest.Y + dest.Height / 2 - num3 / 2, dest.Width + 6, num3);
             *  sb.Draw(Utils.white, rectangle2, this.userScreen.lockedColor);
             *  rectangle2.Height -= 35;
             *  Hacknet.Gui.TextItem.doCenteredFontLabel(rectangle2, LocaleTerms.Loc("Login To Server"), GuiData.font, Color.White, false);
             *  if (Hacknet.Gui.Button.doButton(84109551, rectangle2.X + rectangle2.Width / 2 - rectangle2.Width / 4, rectangle2.Y + rectangle2.Height - 32, rectangle2.Width / 2, 28, "Login", null))
             *  {
             *      this.userScreen.Execute("login");
             *  }
             * //}*/
        }
Ejemplo n.º 17
0
        private void doLSModule()
        {
            this.x = 5;
            this.y = 5;
            int    num  = this.bounds.Width - 25;
            string text = this.userScreen.activeSession.serverName + " " + LocaleTerms.Loc("File System");

            Hacknet.Gui.TextItem.doFontLabel(new Vector2((float)(this.bounds.X + this.x), (float)(this.bounds.Y + this.y)), text, GuiData.font, new Color?(Color.White), (float)this.bounds.Width - 46f, 60f, false);
            if (Hacknet.Gui.Button.doButton(299999, this.bounds.X + (this.bounds.Width - 41), this.bounds.Y + 12, 27, 29, "<-", null))
            {
                Console.WriteLine(this.userScreen.activeSession.workingPath);
                if (this.userScreen.activeSession.workingPath != "/" && this.userScreen.activeSession.workingPath != "")
                {
                    this.userScreen.Execute("cd ..");
                    this.userScreen.Execute("ls");
                }
                else
                {
                    this.state = DisplayState.SSH_SESSION;
                }
            }
            this.y += 50;
            Rectangle dest = GuiData.tmpRect;

            dest.Width  = this.bounds.Width;
            dest.X      = this.bounds.X;
            dest.Y      = this.bounds.Y + 55;
            dest.Height = this.bounds.Height - 57;

            Hacknet.Gui.TextItem.doFontLabel(new Vector2(dest.X, dest.Y), "Working Directory : " + (userScreen.activeSession.workingPath == "" ? "/" : userScreen.activeSession.workingPath), GuiData.smallfont, new Color?(Color.White), (float)this.bounds.Width - 46f, 60f, false);

            int ButtonHeight = (int)(GuiData.ActiveFontConfig.tinyFontCharHeight + 10f);

            dest.Y += 25;

            int width        = dest.Width - 25;
            var sessionState = (LsState)userScreen.activeSession.GetState();

            for (int i = 0; i < sessionState.files.Count; i++)
            {
                if (sessionState.files[i].GetDisplayName() == "" || sessionState.files[i] == null)
                {
                    continue;
                }

                var activeFile = sessionState.files[i];

                //spriteBatch.Draw(Utils.white, new Rectangle((int)bounds.X+6, (int)dest.Y + 3 + (ButtonHeight + 5) * i, 5, (int)ButtonHeight), activeFile.hasWritePermission ? Color.White : Color.Black);
                if (Hacknet.Gui.Button.doButton(300000 + i, bounds.X + 5 + 5, dest.Y + 2 + (ButtonHeight + 5) * i, width - 5, ButtonHeight, activeFile.GetDisplayName(), null))
                {
                    if (activeFile.IsFolder())
                    {
                        this.userScreen.Execute("cd " + activeFile.GetActualName());
                        this.userScreen.Execute("ls");
                    }
                    else
                    {
                        this.userScreen.Execute("view " + activeFile.GetActualName());
                    }
                }
            }
            ;
            //Hacknet.Gui.Button.DisableIfAnotherIsActive = true;
            //Hacknet.Gui.Button.DisableIfAnotherIsActive = false;
        }
Ejemplo n.º 18
0
        private void doConnectDisplay()
        {
            this.doConnectHeader();

            int num  = 0 + 6;
            int num2 = 40;
            int num3 = this.bounds.Height - (this.y - this.bounds.Y) - 20;

            num3 -= num * 5;
            if ((double)num3 / (double)num < (double)num2)
            {
                num2 = (int)((double)num3 / (double)num);
            }

            for (int i = 0; i < userScreen.activeSession.daemonButtons.Count; i++)
            {
                var daemonButton = userScreen.activeSession.daemonButtons[i];
                if (Hacknet.Gui.Button.doButton(29000 + i, this.x, this.y, 300, num2, daemonButton.Display, this.userScreen.highlightColor))
                {
                    this.userScreen.Execute(daemonButton.Command);
                }
                this.y += num2 + 5;
            }
            if (Hacknet.Gui.Button.doButton(300000, this.x, this.y, 300, num2, LocaleTerms.Loc("Login"), this.userScreen.highlightColor))
            {
                userScreen.netManager.Send(HackLinksCommon.NetUtil.PacketType.COMND, "login");


                //Sets prefixcommand inside of OnNetTerminal.cs so that when you press the login button it asks for a username and password and does login (user) (pass) instead of using (user) and (pass) as a commmand.
                //You can prob use prefixcommand for more then just this.
                //userScreen.terminal.currentLine = "";
                //userScreen.terminal.writeLine("(Username) (Password)");
                //userScreen.terminal.prefixcommand = "login";
                //Hacknet.Gui.TextBox.cursorPosition = 0;
                //Hacknet.Gui.TextBox.textDrawOffsetPosition = 0;
                //userScreen.terminal.executionPreventionIsInteruptable = false;

                //VVV What i found when i got here VVV
                //this.userScreen.Execute("login");
            }
            this.y += num2 + 5;

            /*if (Hacknet.Gui.Button.doButton(300002, this.x, this.y, 300, num2, LocaleTerms.Loc("Probe System"), new Color?(this.userScreen.highlightColor)))
             * {
             *  this.userScreen.Execute("probe");
             * }
             * this.y += num2 + 5;*/
            if (Hacknet.Gui.Button.doButton(300003, this.x, this.y, 300, num2, LocaleTerms.Loc("View Filesystem"), this.userScreen.highlightColor))
            {
                this.userScreen.Execute("ls");
            }
            this.y += num2 + 5;

            /*if (Hacknet.Gui.Button.doButton(300009, this.x, this.y, 300, num2, LocaleTerms.Loc("Scan Network"), this.userScreen.highlightColor))
             * {
             *  this.userScreen.Execute("scan");
             * }*/
            this.y = this.bounds.Y + this.bounds.Height - 30;
            if (Hacknet.Gui.Button.doButton(300012, this.x, this.y, 300, 20, LocaleTerms.Loc("Disconnect"), this.userScreen.lockedColor))
            {
                this.userScreen.Execute("dc");
                return;
            }
        }
Ejemplo n.º 19
0
        public void Draw(Rectangle dest, SpriteBatch sb)
        {
            int       width1  = (int)((double)dest.Width * 0.5);
            int       val2    = (int)((double)dest.Height * 0.400000005960464);
            int       val1    = 400;
            bool      flag    = val1 > val2;
            int       height1 = Math.Max(val1, val2);
            Rectangle dest1   = new Rectangle(dest.Width / 2 - width1 / 2, (int)((double)dest.Y + (double)dest.Height / 2.5 - (double)(height1 / 2)), width1, height1);
            Rectangle destinationRectangle1 = new Rectangle(dest.X, dest1.Y + 115 + (flag ? 7 : 0), dest.Width, dest1.Height - 245);

            sb.Draw(Utils.white, destinationRectangle1, Color.Lerp(new Color(115, 0, 0), new Color(122, 0, 0), 0.0f + Utils.randm((float)(1.0 - (double)Utils.randm(1f) * (double)Utils.randm(1f)))));
            dest1.Y += 12;
            TextItem.doFontLabelToSize(dest1, Utils.FlipRandomChars("HACKNET", 0.028), GuiData.titlefont, Color.White * 0.12f, false, false);
            FlickeringTextEffect.DrawLinedFlickeringText(dest1, Utils.FlipRandomChars("HACKNET", 0.003), 11f, 0.7f, GuiData.titlefont, (object)null, Color.White, 5);
            int       y       = destinationRectangle1.Y + dest1.Height - 80;
            int       width2  = dest.Width / 4;
            int       num1    = 20;
            int       num2    = (width2 - num1) / 2;
            int       height2 = 42;
            Rectangle destinationRectangle2 = new Rectangle(dest.X + dest.Width / 2 - width2 / 2, y, width2, height2);

            if (Settings.MultiLingualDemo)
            {
                sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
                if (Button.doButton(18273302, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width, destinationRectangle2.Height, LocaleTerms.Loc("New Session"), new Color?(new Color(124, 137, 149))))
                {
                    LocaleActivator.ActivateLocale("ko-kr", Game1.getSingleton().Content);
                    if (this.Start != null)
                    {
                        this.Start();
                    }
                }
                destinationRectangle2.Y += destinationRectangle2.Height + 12;
                sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
                if (Button.doButton(18273304, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width, destinationRectangle2.Height, "Hacknet Veterans", new Color?(new Color(124, 137, 149))))
                {
                    LocaleActivator.ActivateLocale("en-us", Game1.getSingleton().Content);
                    if (this.StartDLC != null)
                    {
                        this.StartDLC();
                    }
                }
                destinationRectangle2.Y += destinationRectangle2.Height + 12;
                sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
                if (!Button.doButton(18273306, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width, destinationRectangle2.Height, "New Session", new Color?(new Color(124, 137, 149))))
                {
                    return;
                }
                LocaleActivator.ActivateLocale("en-us", Game1.getSingleton().Content);
                if (this.Start != null)
                {
                    this.Start();
                }
            }
            else
            {
                sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
                if (Button.doButton(18273302, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width, destinationRectangle2.Height, LocaleTerms.Loc("New Session"), new Color?(new Color(124, 137, 149))) && this.Start != null)
                {
                    this.Start();
                }
                destinationRectangle2.Y += destinationRectangle2.Height + 12;
                if (Settings.DLCEnabledDemo)
                {
                    sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
                    if (Button.doButton(18273303, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width, destinationRectangle2.Height, LocaleTerms.Loc("Labyrinths (Hacknet Veterans)"), new Color?(new Color(184, 137, 149))) && this.StartDLC != null)
                    {
                        this.StartDLC();
                    }
                }
            }
        }
Ejemplo n.º 20
0
        private static void DrawLogin(DrawMainMenuEvent e)
        {
            RequestGoBack += (Action)(() => ChangeState(MenuState.MAIN_MENU));
            Rectangle  dest      = new Rectangle(bMenu.ScreenManager.GraphicsDevice.Viewport.Width / 4, bMenu.ScreenManager.GraphicsDevice.Viewport.Height / 4, bMenu.ScreenManager.GraphicsDevice.Viewport.Width / 2, bMenu.ScreenManager.GraphicsDevice.Viewport.Height / 4);
            SpriteFont smallfont = GuiData.smallfont;
            int        y1        = dest.Y + dest.Height + 12;
            int        y2        = y1 + 10;
            int        num1      = (int)((double)smallfont.MeasureString(currentPrompt).X + 4.0);
            int        num2      = dest.Y + dest.Height - 18;
            int        num3      = y2 - 60;
            float      num4      = GuiData.ActiveFontConfig.tinyFontCharHeight + 8f;
            Vector2    position  = new Vector2((float)dest.X, false ? (float)y2 : (float)(dest.Y + dest.Height - 20) - num4);

            GuiData.spriteBatch.Draw(Utils.white, new Rectangle(dest.X, y1, dest.Width / 2, 1), Utils.SlightlyDarkGray);
            GuiData.spriteBatch.DrawString(GuiData.UISmallfont, loginMessage, new Vector2(position.X, position.Y + 125), MainMenu.CancelColor);
            GuiData.spriteBatch.DrawString(smallfont, currentPrompt, new Vector2((float)dest.X, (float)num2), Color.White);

            if (IsReady)
            {
                if (!GuiData.getKeyboadState().IsKeyDown(Keys.Enter))
                {
                    CanReturnEnter = true;
                }
                if ((!HasOverlayScreen && (!IsLoginMode || Hacknet.Gui.Button.doButton(16392804, dest.X, y2, dest.Width / 3, 28, LocaleTerms.Loc("CONFIRM"), new Color?(Color.White))) || CanReturnEnter && Utils.keyPressed(GuiData.lastInput, Keys.Enter, new PlayerIndex?())) && !PreventAdvancing)
                {
                    if (IsLoginMode)
                    {
                        if (Answers.Count < 2)
                        {
                            ResetForLogin();
                        }
                        else
                        {
                            string username = Answers[Answers.Count - 2];
                            string password = Answers[Answers.Count - 1];
                            Hacknet.Gui.TextBox.MaskingText = false;
                            StartGame(username, password);
                        }
                    }
                    else
                    {
                        Hacknet.Gui.TextBox.MaskingText = false;
                        Console.Write("An Error has occured! Fixing now");
                        History.Clear();
                        currentPrompt = "";
                        ResetForLogin();
                        IsLoginMode = true;
                    }
                    PreventAdvancing = true;
                }
                y2 += 36;
            }
            else
            {
                Hacknet.Gui.TextBox.MaskingText = InPasswordMode;
                terminalString = Hacknet.Gui.TextBox.doTerminalTextField(16392802, dest.X + num1, num2 - 2, dest.Width, 20, 1, terminalString, GuiData.UISmallfont);
            }

            if (!HasOverlayScreen && Hacknet.Gui.TextBox.BoxWasActivated)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(currentPrompt);
                stringBuilder.Append(" ");
                string str1 = terminalString;
                if (InPasswordMode)
                {
                    string str2 = "";
                    for (int index = 0; index < str1.Length; ++index)
                    {
                        str2 += "*";
                    }
                    str1 = str2;
                }
                stringBuilder.Append(str1);
                History.Add(stringBuilder.ToString());
                Advance(terminalString);
                terminalString = "";
                Hacknet.Gui.TextBox.cursorPosition  = 0;
                Hacknet.Gui.TextBox.BoxWasActivated = false;
            }
            if (!HasOverlayScreen && Hacknet.Gui.Button.doButton(16392806, dest.X, y2, dest.Width / 3, 22, LocaleTerms.Loc("CANCEL"), new Color?(CancelColor)) && RequestGoBack != null)
            {
                InPasswordMode = false;
                Hacknet.Gui.TextBox.MaskingText = false;
                RequestGoBack();
            }

            for (int index = History.Count - 1; index >= 0; --index)
            {
                GuiData.spriteBatch.DrawString(GuiData.UISmallfont, History[index], position, Color.White);
                position.Y -= num4 * (1f);
            }
        }
Ejemplo n.º 21
0
        public static bool onOSDraw(OS self, ref GameTime time)
        {
            var osStartDrawEvent = new Event.OSStartDrawEvent(self, time);

            Event.OSEndDrawEvent osEndDrawEvent = null;
            try
            {
                if (self.lastGameTime == null)
                {
                    self.lastGameTime = time;
                }
                switch (osStartDrawEvent.DrawType)
                {
                case Event.OSDrawEvent.Type.Standard:
                    PostProcessor.begin();
                    GuiData.startDraw();
                    osStartDrawEvent.CallEvent();
                    if (osStartDrawEvent.IsCancelled)
                    {
                        break;
                    }
                    try
                    {
                        if (!self.TraceDangerSequence.PreventOSRendering)
                        {
                            self.drawBackground();
                            if (self.terminalOnlyMode)
                            {
                                self.terminal.Draw((float)time.ElapsedGameTime.TotalSeconds);
                            }
                            else
                            {
                                self.drawModules(time);
                            }
                            SFX.Draw(GuiData.spriteBatch);
                        }
                        if (self.TraceDangerSequence.IsActive)
                        {
                            self.TraceDangerSequence.Draw();
                        }
                    }
                    catch (Exception ex)
                    {
                        self.drawErrorCount++;
                        if (self.drawErrorCount < 5)
                        {
                            Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex) + "\r\n\r\n");
                        }
                    }
                    break;

                case Event.OSDrawEvent.Type.BootingSequence:
                    osStartDrawEvent.IgnoreScanlines = true;
                    goto case Event.OSDrawEvent.Type.EndingSequence;

                case Event.OSDrawEvent.Type.BootAssistance:
                case Event.OSDrawEvent.Type.EndingSequence:
                    PostProcessor.begin();
                    osStartDrawEvent.CallEvent();
                    if (osStartDrawEvent.IsCancelled)
                    {
                        break;
                    }
                    self.ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
                    switch (osStartDrawEvent.DrawType)
                    {
                    case Event.OSDrawEvent.Type.BootAssistance:
                        self.BootAssitanceModule.Draw((float)time.ElapsedGameTime.TotalSeconds);
                        break;

                    case Event.OSDrawEvent.Type.BootingSequence:
                        if (self.thisComputer.disabled)
                        {
                            self.RequestRemovalOfAllPopups();
                            if (self.TraceDangerSequence.IsActive)
                            {
                                self.TraceDangerSequence.CancelTraceDangerSequence();
                            }
                            self.crashModule.Draw((float)time.ElapsedGameTime.TotalSeconds);
                        }
                        else
                        {
                            self.introTextModule.Draw((float)time.ElapsedGameTime.TotalSeconds);
                        }
                        break;

                    case Event.OSDrawEvent.Type.EndingSequence:
                        self.endingSequence.Draw((float)time.ElapsedGameTime.TotalSeconds);
                        break;
                    }
                    if (!osStartDrawEvent.IgnoreScanlines)
                    {
                        self.drawScanlines();
                    }
                    break;

                case Event.OSDrawEvent.Type.Loading:
                    GuiData.startDraw();
                    osStartDrawEvent.CallEvent();
                    if (osStartDrawEvent.IsCancelled)
                    {
                        break;
                    }
                    TextItem.doSmallLabel(new Vector2(0f, 700f), LocaleTerms.Loc("Loading..."), null);
                    break;

                case Event.OSDrawEvent.Type.Custom:
                    osStartDrawEvent.CallEvent();
                    if (osStartDrawEvent.IsCancelled)
                    {
                        return(true);
                    }
                    break;
                }
                osEndDrawEvent = new Event.OSEndDrawEvent(self, time, osStartDrawEvent.DrawType);
                switch (osEndDrawEvent.DrawType)
                {
                case Event.OSDrawEvent.Type.Standard:
                    GuiData.endDraw();
                    PostProcessor.end();
                    if (!osStartDrawEvent.IgnorePostFXDraw)
                    {
                        GuiData.startDraw();
                        if (self.postFXDrawActions != null)
                        {
                            self.postFXDrawActions.Invoke();
                            self.postFXDrawActions = null;
                        }
                        if (!osStartDrawEvent.IgnoreScanlines)
                        {
                            self.drawScanlines();
                        }
                        GuiData.endDraw();
                    }
                    break;

                case Event.OSDrawEvent.Type.BootAssistance:
                case Event.OSDrawEvent.Type.BootingSequence:
                case Event.OSDrawEvent.Type.EndingSequence:
                    self.ScreenManager.SpriteBatch.End();
                    PostProcessor.end();
                    break;

                case Event.OSDrawEvent.Type.Loading:
                    GuiData.endDraw();
                    break;

                default:
                    osEndDrawEvent.CallEvent();
                    break;
                }
            }
            catch (Exception ex)
            {
                osEndDrawEvent = new Event.OSEndDrawEvent(self, time, Event.OSDrawEvent.Type.Error);
                osEndDrawEvent.CallEvent();
                if (osEndDrawEvent.IsCancelled)
                {
                    return(true);
                }
                self.drawErrorCount++;
                if (self.drawErrorCount >= 3)
                {
                    self.handleDrawError();
                }
                else
                {
                    Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                }
            }
            return(true);
        }
Ejemplo n.º 22
0
        private Vector2 DrawExtensionInfoDetail(Vector2 drawpos, Rectangle dest, SpriteBatch sb, ScreenManager screenMan, ExtensionInfo info)
        {
            sb.DrawString(GuiData.titlefont, info.Name.ToUpper(), drawpos, Utils.AddativeWhite * 0.66f);
            drawpos.Y += 80f;
            int height1 = sb.GraphicsDevice.Viewport.Height;
            int num1    = 256;

            if (height1 < 900)
            {
                num1 = 120;
            }
            Rectangle dest1   = new Rectangle((int)drawpos.X, (int)drawpos.Y, num1, num1);
            Texture2D texture = this.DefaultModImage;

            if (info.LogoImage != null)
            {
                texture = info.LogoImage;
            }
            FlickeringTextEffect.DrawFlickeringSprite(sb, dest1, texture, 2f, 0.5f, (object)null, Color.White);
            Vector2 position = drawpos + new Vector2((float)num1 + 40f, 20f);
            float   num2     = (float)dest.Width - (drawpos.X - (float)dest.X);
            string  text1    = Utils.SuperSmartTwimForWidth(info.Description, (int)num2, GuiData.smallfont);

            sb.DrawString(GuiData.smallfont, text1, position, Utils.AddativeWhite * 0.7f);
            drawpos.Y += (float)num1 + 10f;
            if (this.IsInPublishScreen)
            {
                Rectangle fullscreen = Utils.GetFullscreen();
                Rectangle dest2      = new Rectangle((int)drawpos.X, (int)drawpos.Y, fullscreen.Width - (int)drawpos.X * 2, fullscreen.Height - ((int)drawpos.Y + 50));
                return(this.workshopPublishScreen.Draw(sb, dest2, info));
            }
            if (this.ReportOverride != null)
            {
                string text2 = Utils.SuperSmartTwimForWidth(this.ReportOverride, 800, GuiData.smallfont);
                sb.DrawString(GuiData.smallfont, text2, drawpos + new Vector2(460f, 0.0f), this.ReportOverride.Length > 250 ? Utils.AddativeRed : Utils.AddativeWhite);
            }
            int val1    = 40;
            int num3    = 5;
            int num4    = info.AllowSave ? 4 : 2;
            int num5    = height1 - (int)drawpos.Y - 55;
            int height2 = Math.Min(val1, (num5 - num4 * num3) / num4);

            if (Button.doButton(7900010, (int)drawpos.X, (int)drawpos.Y, 450, height2, string.Format(LocaleTerms.Loc("New {0} Account"), (object)info.Name), new Color?(MainMenu.buttonColor)))
            {
                this.State = ExtensionsMenuScreen.EMSState.GetUsername;
                this.SaveScreen.ResetForNewAccount();
            }
            drawpos.Y += (float)(height2 + num3);
            if (info.AllowSave)
            {
                bool flag = !string.IsNullOrWhiteSpace(SaveFileManager.LastLoggedInUser.FileUsername);
                if (Button.doButton(7900019, (int)drawpos.X, (int)drawpos.Y, 450, height2, flag ? "Continue Account : " + SaveFileManager.LastLoggedInUser.Username : "******", new Color?(flag ? MainMenu.buttonColor : Color.Black)))
                {
                    OS.WillLoadSave = true;
                    if (this.LoadAccountForExtension_FileAndUsername != null)
                    {
                        this.LoadAccountForExtension_FileAndUsername(SaveFileManager.LastLoggedInUser.FileUsername, SaveFileManager.LastLoggedInUser.Username);
                    }
                }
                drawpos.Y += (float)(height2 + num3);
                if (Button.doButton(7900020, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Login") + "...", new Color?(flag ? MainMenu.buttonColor : Color.Black)))
                {
                    this.State = ExtensionsMenuScreen.EMSState.ShowAccounts;
                    this.SaveScreen.ResetForLogin();
                }
                drawpos.Y += (float)(height2 + num3);
            }
            if (Button.doButton(7900030, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Run Verification Tests"), new Color?(MainMenu.buttonColor)))
            {
                int    errorsAdded = 0;
                string str1        = ExtensionTests.TestExtensionForRuntime(screenMan, info.FolderPath, out errorsAdded);
                try
                {
                    ExtensionInfo.VerifyExtensionInfo(info);
                }
                catch (Exception ex)
                {
                    str1 = str1 + "\nExtension Metadata Error:\n" + Utils.GenerateReportFromException(ex);
                    ++errorsAdded;
                }
                if (errorsAdded == 0)
                {
                    this.ReportOverride = LocaleTerms.Loc("Testing...") + "\n" + LocaleTerms.Loc("All tests complete") + "\n0 " + LocaleTerms.Loc("Errors Found");
                }
                else
                {
                    this.ReportOverride = LocaleTerms.Loc("Errors Found") + ". " + string.Format(LocaleTerms.Loc("Writing report to {0}"), (object)(info.FolderPath + "/report.txt\n").Replace("\\", "/")) + str1;
                    string str2 = info.FolderPath + "/report.txt";
                    if (File.Exists(str2))
                    {
                        File.Delete(str2);
                    }
                    Utils.writeToFile(this.ReportOverride, str2);
                }
                MusicManager.transitionToSong("Music/Ambient/AmbientDrone_Clipped");
                ExtensionLoader.ActiveExtensionInfo = this.ExtensionInfoToShow;
            }
            drawpos.Y += (float)(height2 + num3);
            if (Settings.AllowExtensionPublish && PlatformAPISettings.Running)
            {
                if (Button.doButton(7900031, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Steam Workshop Publishing"), new Color?(MainMenu.buttonColor)))
                {
                    this.IsInPublishScreen = true;
                }
                drawpos.Y += (float)(height2 + num3);
            }
            if (Button.doButton(7900040, (int)drawpos.X, (int)drawpos.Y, 450, 25, LocaleTerms.Loc("Back to Extension List"), new Color?(MainMenu.exitButtonColor)))
            {
                this.ExtensionInfoToShow = (ExtensionInfo)null;
            }
            drawpos.Y += 30f;
            return(drawpos);
        }
Ejemplo n.º 23
0
        public void Draw(Rectangle dest, SpriteBatch sb, ScreenManager screenman)
        {
            this.EnsureHasLoaded();
            Rectangle  rectangle = new Rectangle(dest.X, dest.Y, dest.Width, 40);
            Color      color     = Color.Lerp(Utils.AddativeWhite, Utils.AddativeRed, 0.3f + Utils.randm(0.22f));
            SpriteFont font      = GuiData.font;
            Vector2    vector2_1 = new Vector2((float)dest.X, (float)dest.Y + 44f);
            string     original  = "E X T E N S I O N S";

            GuiData.spriteBatch.DrawString(font, Utils.FlipRandomChars(original, 0.0179999992251396), vector2_1, Utils.AddativeWhite * (0.17f + Utils.randm(0.04f)));
            GuiData.spriteBatch.DrawString(font, Utils.FlipRandomChars(original, 0.00400000018998981), vector2_1, color * (0.8f + Utils.randm(0.04f)));
            vector2_1.Y += 35f;
            Vector2 vector2_2;

            if (this.ExtensionInfoToShow == null)
            {
                vector2_2 = this.DrawExtensionList(vector2_1, dest, sb);
            }
            else
            {
                switch (this.State)
                {
                case ExtensionsMenuScreen.EMSState.GetUsername:
                case ExtensionsMenuScreen.EMSState.ShowAccounts:
                    Rectangle dest1 = new Rectangle(dest.X, dest.Y + dest.Height / 4, dest.Width, (int)((double)dest.Height * 0.800000011920929));
                    vector2_2 = this.DrawExtensionCreateNewUserOrLoadScreen(vector2_1, dest1, sb, screenman, this.ExtensionInfoToShow);
                    break;

                default:
                    vector2_2 = this.DrawExtensionInfoDetail(vector2_1, dest, sb, screenman, this.ExtensionInfoToShow);
                    break;
                }
            }
            if (!Button.doButton(391481, (int)vector2_2.X, (int)vector2_2.Y, 450, 25, LocaleTerms.Loc("Return to Main Menu"), new Color?(MainMenu.exitButtonColor)))
            {
                return;
            }
            this.ExitExtensionsScreen();
        }
Ejemplo n.º 24
0
 public static void OverrideFirstTimeInit(CommandSentEvent e)
 {
     if (Extension.Handler.ActiveInfo != null &&
         e[0] == "FirstTimeInitdswhupwnemfdsiuoewnmdsmffdjsklanfeebfjkalnbmsdakj")
     {
         var os    = e.OS;
         var num   = Settings.isConventionDemo ? 80 : 200;
         var num2  = Settings.isConventionDemo ? 150 : 300;
         var doTut = e[1] == "StartTutorial";
         if (doTut)
         {
             os.display.visible    = false;
             os.ram.visible        = false;
             os.netMap.visible     = false;
             os.terminal.visible   = true;
             os.mailicon.isEnabled = false;
             if (os.hubServerAlertsIcon != null)
             {
                 os.hubServerAlertsIcon.IsEnabled = false;
             }
         }
         if (Settings.debugCommandsEnabled && GuiData.getKeyboadState().IsKeyDown(Keys.LeftAlt))
         {
             num2 = (num = 1);
         }
         Programs.typeOut("Initializing .", os, 50);
         Programs.doDots(7, num + 100, os);
         Programs.typeOut("Loading modules.", os, 50);
         Programs.doDots(5, num, os);
         os.writeSingle("Complete");
         Utility.HaltThread(num2);
         Programs.typeOut("Loading nodes.", os, 50);
         Programs.doDots(5, num, os);
         os.writeSingle("Complete");
         Utility.HaltThread(num2);
         Programs.typeOut("Reticulating splines.", os, 50);
         Programs.doDots(5, num - 50, os);
         os.writeSingle("Complete");
         Utility.HaltThread(num2);
         if (os.crashModule.BootLoadErrors.Length > 0)
         {
             Programs.typeOut("\n------ " + LocaleTerms.Loc("BOOT ERRORS DETECTED") + " ------", os, 50);
             Utility.HaltThread(200);
             var array = os.crashModule.BootLoadErrors.Split(Utils.newlineDelim, StringSplitOptions.RemoveEmptyEntries);
             for (int i = 0; i < array.Length; i++)
             {
                 Programs.typeOut(array[i], os, 50);
                 Utility.HaltThread(100, true);
             }
             Programs.typeOut("---------------------------------\n", os, 50);
             Utility.HaltThread(200, true);
         }
         Programs.typeOut("\n--Initialization Complete--\n", os, 50);
         GuiData.getFilteredKeys();
         os.inputEnabled = true;
         Utility.HaltThread(num2 + 100);
         if (!doTut)
         {
             Programs.typeOut(LocaleTerms.Loc("For A Command List, type \"help\""), os, 50);
             Utility.HaltThread(num2 + 100);
         }
         os.write("");
         Utility.HaltThread(num2);
         os.write("");
         Utility.HaltThread(num2);
         os.write("");
         Utility.HaltThread(num2);
         os.write("\n");
         if (doTut)
         {
             os.write(LocaleTerms.Loc("Launching Tutorial..."));
             os.launchExecutable("Tutorial.exe", PortExploits.crackExeData[1], -1, null, null);
             Settings.initShowsTutorial = false;
             AdvancedTutorial advancedTutorial = null;
             for (int i = 0; i < os.exes.Count; i++)
             {
                 advancedTutorial = (os.exes[i] as AdvancedTutorial);
                 if (advancedTutorial != null)
                 {
                     break;
                 }
             }
             if (advancedTutorial != null)
             {
                 advancedTutorial.CanActivateFirstStep = false;
             }
             int num3 = 100;
             for (int i = 0; i < num3; i++)
             {
                 double num4 = (double)i / num3;
                 if (Utils.random.NextDouble() < num4)
                 {
                     os.ram.visible      = true;
                     os.netMap.visible   = false;
                     os.terminal.visible = false;
                 }
                 else
                 {
                     os.ram.visible      = false;
                     os.netMap.visible   = false;
                     os.terminal.visible = true;
                 }
                 Utility.HaltThread(16, true);
             }
             os.ram.visible      = true;
             os.netMap.visible   = false;
             os.terminal.visible = false;
             if (advancedTutorial != null)
             {
                 advancedTutorial.CanActivateFirstStep = true;
             }
         }
         else
         {
             os.runCommand("connect " + os.thisComputer.ip);
             if (doTut && !OS.WillLoadSave && !os.Flags.HasFlag("ExtensionFirstBootComplete"))
             {
                 ExtensionLoader.SendStartingEmailForActiveExtensionNextFrame(os);
                 float num5 = 2.2f;
                 var   num3 = (int)(60f * num5);
                 for (int i = 0; i < num3; i++)
                 {
                     double num4 = (double)i / num3;
                     os.ram.visible     = (Utils.random.NextDouble() < num4);
                     os.netMap.visible  = (Utils.random.NextDouble() < num4);
                     os.display.visible = (Utils.random.NextDouble() < num4);
                     Utility.HaltThread(16, true);
                 }
                 os.terminal.visible    = true;
                 os.display.visible     = true;
                 os.netMap.visible      = true;
                 os.ram.visible         = true;
                 os.terminal.visible    = true;
                 os.display.inputLocked = false;
                 os.netMap.inputLocked  = false;
                 os.ram.inputLocked     = false;
                 os.Flags.AddFlag("ExtensionFirstBootComplete");
             }
         }
         Utility.HaltThread(500, true);
         if (wasRecursed)
         {
             os.ram.visible         = true;
             os.ram.inputLocked     = false;
             os.display.visible     = true;
             os.display.inputLocked = false;
             os.netMap.visible      = true;
             os.netMap.inputLocked  = false;
         }
         else if (doTut)
         {
             os.ram.visible         = true;
             os.ram.inputLocked     = false;
             os.display.visible     = true;
             os.display.inputLocked = false;
             os.netMap.visible      = true;
             os.netMap.inputLocked  = false;
         }
         else if (!os.ram.visible)
         {
             wasRecursed = true;
             OverrideFirstTimeInit(e);
         }
     }
 }
Ejemplo n.º 25
0
        public static string DrawGetStringControl(string prompt, Rectangle bounds, Action errorOccurs, Action cancelled, SpriteBatch sb, object os_obj, Color SearchButtonColor, Color CancelButtonColor, string upperPrompt = null, Color?BackingPanelColor = null)
        {
            OS os = (OS)os_obj;

            upperPrompt = upperPrompt == null ? prompt : upperPrompt;
            string  str  = "";
            int     x    = bounds.X + 6;
            int     y1   = bounds.Y + 2;
            Vector2 zero = Vector2.Zero;

            if (upperPrompt.Length > 0)
            {
                Vector2 vector2 = TextItem.doMeasuredSmallLabel(new Vector2((float)x, (float)y1), upperPrompt, new Color?());
                y1 += (int)vector2.Y + 10;
            }
            string[] separator = new string[1] {
                "#$#$#$$#$&$#$#$#$#"
            };
            string[] strArray = os.getStringCache.Split(separator, StringSplitOptions.None);
            if (strArray.Length > 1)
            {
                str = strArray[1];
                if (str.Equals(""))
                {
                    str = os.terminal.currentLine;
                }
            }
            Rectangle destinationRectangle = new Rectangle(x, y1, bounds.Width - 12, bounds.Height - 46);

            sb.Draw(Utils.white, destinationRectangle, BackingPanelColor.HasValue ? BackingPanelColor.Value : os.darkBackgroundColor);
            int     num              = y1 + 18;
            string  bracketedBit     = "";
            string  bracketedSection = Utils.ExtractBracketedSection(prompt, out bracketedBit);
            Vector2 vector2_1        = TextItem.doMeasuredSmallLabel(new Vector2((float)x, (float)num), bracketedSection + str, new Color?());

            TextItem.doSmallLabel(new Vector2((float)x, (float)((double)num + (double)vector2_1.Y + 2.0)), bracketedBit, new Color?());
            destinationRectangle.X      = x + (int)vector2_1.X + 2;
            destinationRectangle.Y      = num;
            destinationRectangle.Width  = 7;
            destinationRectangle.Height = 20;
            if ((double)os.timer % 1.0 < 0.300000011920929)
            {
                sb.Draw(Utils.white, destinationRectangle, os.outlineColor);
            }
            int y2 = num + (bounds.Height - 44);

            if (strArray.Length > 2 || Button.doButton(30, x, y2, 300, 22, LocaleTerms.Loc("Search"), new Color?(SearchButtonColor)))
            {
                if (strArray.Length <= 2)
                {
                    os.terminal.executeLine();
                }
                if (str.Length > 0)
                {
                    return(str);
                }
                errorOccurs();
                return((string)null);
            }
            if (Button.doButton(38, x, y2 + 24, 300, 22, LocaleTerms.Loc("Cancel"), new Color?(CancelButtonColor)))
            {
                cancelled();
                os.terminal.clearCurrentLine();
                os.terminal.executeLine();
            }
            return((string)null);
        }
Ejemplo n.º 26
0
        private void doConnectHeader()
        {
            this.x += 20;
            this.y += 5;
            this.spriteBatch.DrawString(GuiData.font, LocaleTerms.Loc("Connected to") + " ", new Vector2((float)(this.x + 160), (float)this.y), Color.White);
            this.y += 40;
            string text = userScreen.activeSession.serverName;

            Hacknet.Gui.TextItem.doFontLabel(new Vector2((float)(this.x + 160), (float)this.y), text, GuiData.font, new Color?(Color.White), (float)this.bounds.Width - 190f, 60f, false);
            this.y += 33;
            float num = Hacknet.Localization.LocaleActivator.ActiveLocaleIsCJK() ? 4f : 0f;

            this.spriteBatch.DrawString(GuiData.smallfont, "@  " + userScreen.activeSession.ip, new Vector2((float)(this.x + 160), (float)this.y + num), Color.White);
            this.y += 60;
            if (userScreen.activeSession.privilege != 3)
            {
                this.y -= 20;
                Rectangle _empty = Rectangle.Empty;
                _empty.X      = this.bounds.X + 1;
                _empty.Y      = this.y;
                _empty.Width  = this.bounds.Width - 2;
                _empty.Height = 20;
                int   priv         = userScreen.activeSession.privilege;
                Color accountColor = userScreen.guestAccountColor;
                if (priv == 2)
                {
                    accountColor = userScreen.userAccountColor;
                }
                else if (priv == 1)
                {
                    accountColor = userScreen.adminAccountColor;
                }
                else if (priv == 0)
                {
                    accountColor = userScreen.kernelAccountColor;
                }
                this.spriteBatch.Draw(Utils.white, _empty, accountColor);

                var     _text   = LocaleTerms.Loc("You are " + userScreen.activeSession.GetRankName() + " on this System");
                Vector2 _vector = GuiData.UISmallfont.MeasureString(_text);

                var _pos = new Vector2((float)(_empty.X + _empty.Width / 2) - _vector.X / 2f, (float)_empty.Y);

                this.spriteBatch.DrawString(GuiData.UISmallfont, _text, _pos, Color.Black);

                if (this.bounds.Height > 500)
                {
                    this.y += 30;
                }
                else
                {
                    this.y += 12;
                }
            }

            Rectangle empty = Rectangle.Empty;

            empty.X      = this.bounds.X + 1;
            empty.Y      = this.y;
            empty.Width  = this.bounds.Width - 2;
            empty.Height = 20;
            this.spriteBatch.Draw(Utils.white, empty, this.userScreen.highlightColor);

            string  text2  = LocaleTerms.Loc("You are currently logged as : ") + userScreen.activeSession.accountName;
            Vector2 vector = GuiData.UISmallfont.MeasureString(text2);

            var pos = new Vector2((float)(empty.X + empty.Width / 2) - vector.X / 2f, (float)empty.Y);

            if (Hacknet.Localization.LocaleActivator.ActiveLocaleIsCJK())
            {
                pos.Y = pos.Y - 2f;
            }
            userScreen.postFXDrawActions = (Action)System.Delegate.Combine(userScreen.postFXDrawActions, new Action(delegate
            {
                this.spriteBatch.DrawString(GuiData.UISmallfont, text2, pos, Color.Black);
            }));
            if (this.bounds.Height > 500)
            {
                this.y += 40;
            }
            else
            {
                this.y += 12;
            }
        }
Ejemplo n.º 27
0
        public static bool onDrawMainMenuTitles(MainMenu self, out bool result, ref Rectangle dest)
        {
            if (defaultTitleFont == null)
            {
                defaultTitleFont = self.ScreenManager.Game.Content.Load <SpriteFont>("Kremlin");
            }
            Logger.Verbose("Redrawing Main Menu Titles");
            var version   = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            var mainTitle = "HACKNET";
            var subtitle  = "OS"
                            + (DLC1SessionUpgrader.HasDLC1Installed ? "+Labyrinths " : " ")
                            + MainMenu.OSVersion + " Pathfinder " + version;

            result = true;
            if (Settings.IsExpireLocked)
            {
                TimeSpan timeSpan = Settings.ExpireTime - DateTime.Now;
                string   text3;
                if (timeSpan.TotalSeconds < 1.0)
                {
                    text3  = LocaleTerms.Loc("TEST BUILD EXPIRED - EXECUTION DISABLED");
                    result = false;
                }
                else
                {
                    text3 = "Test Build : Expires in " + timeSpan.ToString();
                }
                TextItem.doFontLabel(new Vector2(180f, 105f), text3, GuiData.smallfont, Color.Red * 0.8f, 600f, 26f, false);
            }
            var main = new MainTitleData(mainTitle,
                                         defaultTitleColor,
                                         defaultTitleFont,
                                         dest
                                         );
            var sub = new SubTitleData(subtitle,
                                       main.Color * 0.5f,
                                       GuiData.smallfont,
                                       new Vector4(520, 178, 0, 0)
                                       );
            var drawMainMenuTitles = new Event.DrawMainMenuTitlesEvent(self, main, sub);

            drawMainMenuTitles.CallEvent();
            if (drawMainMenuTitles.IsCancelled)
            {
                return(true);
            }
            main = drawMainMenuTitles.Main;
            sub  = drawMainMenuTitles.Sub;
            FlickeringTextEffect.DrawLinedFlickeringText(
                dest = main.Destination,
                main.Title,
                7f,
                0.55f,
                main.Font,
                null,
                main.Color
                );
            TextItem.doFontLabel(sub.Destination, sub.Title, sub.Font, sub.Color, 600f, 26f);
            Logger.Verbose("Finished Redrawing Main Menu Titles");
            return(true);
        }
Ejemplo n.º 28
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            ScreenManager.FadeBackBufferToBlack(255);
            GuiData.startDraw();
            PatternDrawer.draw(new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height), 0.5f, Color.Black, new Color(2, 2, 2), GuiData.spriteBatch);
            if (Button.doButton("Back".GetHashCode(), 10, 10, 220, 30, "<- " + LocaleTerms.Loc("Back"), Color.Gray))
            {
                if (IsChange && !Saved)
                {
                    ScreenManager.AddScreen(MessageBox_NeedSave, ScreenManager.controllingPlayer);
                }
                SettingsLoader.writeStatusFile();
                ExitScreen();
            }
            if (Button.doButton("Save".GetHashCode(), 10, 45, 220, 30, "ModsCore.Mods.Save".Translate(), Color.Blue))
            {
                Save();
            }

            TextItem.doLabel(new Vector2(75, 100), $"Mods ({"ModsCore.Mods.Activate".Translate()})", null, 300);

            //打开了Setting界面不允许修改选定的Mod
            if (OpenSettingUI)
            {
                SelectableTextList.doFancyList(25, 50, 140, 300, ScreenManager.GraphicsDevice.Viewport.Height - 190, m_ActivatedMods.ToArray(), currentActMods, Color.White);
            }
            else
            {
                currentActMods = SelectableTextList.doFancyList(25, 50, 140, 300, ScreenManager.GraphicsDevice.Viewport.Height - 50, m_ActivatedMods.ToArray(), currentActMods, Color.White);
            }

            if (OpenSettingUI && Button.doButton("CloseSettingUI".GetHashCode(), 400, 210, 150, 30, "ModsCore.Mods.CloseSettingUI".Translate(), Color.BlueViolet))
            {
                OpenSettingUI = false;
            }
            if (currentActMods > 0 && Button.doButton("Up".GetHashCode(), 400, 250, 150, 30, "ModsCore.Mods.Up".Translate(), Color.BlueViolet))
            {
                MoveUp();
                IsChange = true;
                Saved    = false;
            }
            if (currentActMods >= 0 && currentActMods != m_ActivatedMods.Count - 1 && Button.doButton("Down".GetHashCode(), 400, 290, 150, 30, "ModsCore.Mods.Down".Translate(), Color.BlueViolet))
            {
                MoveDown();
                IsChange = true;
                Saved    = false;
            }
            if (!OpenSettingUI && currentActMods != -1 && Button.doButton("OpenSettingUI".GetHashCode(), 400, 210, 150, 30, "ModsCore.Mods.OpenSettingUI".Translate(), Color.BlueViolet))
            {
                OpenSettingUI = true;
            }

            if (currentActMods >= 0 && Button.doButton("DeactivateMod".GetHashCode(), 400, 330, 150, 30, "ModsCore.Mods.DeactivateMod".Translate(), Color.BlueViolet))
            {
                IsChange = true;
                Saved    = false;
                m_DeactivatedMods.Add(m_ActivatedMods[currentActMods]);
                m_DeactDicModModEntries.Add(m_ActivatedMods[currentActMods].GetHashCode(), m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()]);
                m_ActDicModEntries.Remove(m_ActivatedMods[currentActMods].GetHashCode());
                m_ActivatedMods.RemoveAt(currentActMods);

                ModManager.ModsConfig ModsConfig = (ModManager.ModsConfig)ModsConfig_FieldInfo.GetValue(new ModManager());
                ModsConfig.EnabledMod.RemoveAt(currentActMods);
                ModsConfig_FieldInfo.SetValue(null, ModsConfig);
                currentDeactMods = m_DeactivatedMods.Count - 1;
                currentActMods   = -1;
            }

            if (!OpenSettingUI && currentDeactMods >= 0 && Button.doButton("ActivateMod".GetHashCode(), 400, 370, 150, 30, "ModsCore.Mods.ActivateMod".Translate(), Color.BlueViolet))
            {
                IsChange = true;
                Saved    = false;
                m_ActivatedMods.Add(m_DeactivatedMods[currentDeactMods]);
                m_ActDicModEntries.Add(m_DeactivatedMods[currentDeactMods].GetHashCode(), m_DeactDicModModEntries[m_DeactivatedMods[currentDeactMods].GetHashCode()]);


                ModManager.ModsConfig ModsConfig = (ModManager.ModsConfig)ModsConfig_FieldInfo.GetValue(new ModManager());
                ModsConfig.EnabledMod.Add(Path.GetFileName(m_DeactDicModModEntries[m_DeactivatedMods[currentDeactMods].GetHashCode()].Path));
                ModsConfig_FieldInfo.SetValue(null, ModsConfig);

                m_DeactDicModModEntries.Remove(m_DeactivatedMods[currentDeactMods].GetHashCode());
                m_DeactivatedMods.RemoveAt(currentDeactMods);
                currentActMods   = m_ActivatedMods.Count - 1;
                currentDeactMods = -1;
            }

            if (OpenSettingUI && m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()].Started && m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()].DrawSettingUIMethod != null)
            {
                RenderedRectangle.doRectangleOutline(570, 100, ScreenManager.GraphicsDevice.Viewport.Width - 50 - 570, ScreenManager.GraphicsDevice.Viewport.Height - 100 - 50, 2, Color.White);
                m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()].DrawSettingUIMethod(m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()], new object[] { ScreenManager, 575, 100, ScreenManager.GraphicsDevice.Viewport.Width - 50 - 570, ScreenManager.GraphicsDevice.Viewport.Height - 100 - 50 });
            }
            else
            {
                TextItem.doLabel(new Vector2(600, 100), $"Mods ({"ModsCore.Mods.Deactivate".Translate()})", null, 300);
                currentDeactMods = SelectableTextList.doFancyList(25, 575, 140, 300, ScreenManager.GraphicsDevice.Viewport.Height - 50, m_DeactivatedMods.ToArray(), currentDeactMods, null);
            }
            GuiData.endDraw();
            PostProcessor.end();
        }
Ejemplo n.º 29
0
        public void DrawUI(Rectangle dest, OS os)
        {
            int ButtonHeight = (int)((double)GuiData.ActiveFontConfig.tinyFontCharHeight + 10.0);

            if (this.panel.PanelHeight != ButtonHeight + 4)
            {
                this.panel = new ScrollableSectionedPanel(ButtonHeight + 4, GuiData.spriteBatch.GraphicsDevice);
            }
            List <DisplayModuleLSHelper.LSItem> items = this.BuildDirectoryDrawList(os.connectedComp == null ? os.thisComputer.files.root : os.connectedComp.files.root, 0, 0, os);

            this.panel.NumberOfPanels = items.Count;
            int width = dest.Width - 25;
            Action <int, Rectangle, SpriteBatch> DrawSection = (Action <int, Rectangle, SpriteBatch>)((index, bounds, sb) =>
            {
                DisplayModuleLSHelper.LSItem lsItem = items[index];
                if (lsItem.IsEmtyDisplay)
                {
                    TextItem.doFontLabel(new Vector2((float)(bounds.X + 5 + lsItem.indent), (float)(bounds.Y + 2)), "-" + LocaleTerms.Loc("Empty") + "-", GuiData.tinyfont, new Color?(), (float)width, (float)ButtonHeight, false);
                }
                else if (Button.doButton(300000 + index, bounds.X + 5 + lsItem.indent, bounds.Y + 2, width - lsItem.indent, ButtonHeight, lsItem.DisplayName, new Color?()))
                {
                    lsItem.Clicked();
                }
            });

            Button.DisableIfAnotherIsActive = true;
            this.panel.Draw(DrawSection, GuiData.spriteBatch, dest);
            Button.DisableIfAnotherIsActive = false;
        }
Ejemplo n.º 30
0
        public static void DrawLoadingEffect(Rectangle bounds, SpriteBatch sb, object OS_obj, bool drawLoadingText = true)
        {
            OS        os        = (OS)OS_obj;
            Rectangle rectangle = new Rectangle(bounds.X + bounds.Width / 2, bounds.Y + bounds.Height / 2, 2, 70);
            float     num1      = (float)Math.Abs(Math.Sin((double)os.timer * 0.200000002980232) * 100.0);
            Vector2   origin    = new Vector2(2f, 10f);
            float     num2      = 6.283185f / num1;
            float     rotation  = 0.0f;
            int       num3      = 0;

            while ((double)rotation < 6.28318548202515)
            {
                Rectangle destinationRectangle = rectangle;
                destinationRectangle.Height = Math.Abs((int)((double)rectangle.Height * Math.Sin(2.0 * (double)os.timer + (double)num3 * 0.200000002980232))) + 10;
                origin.Y = 1.6f;
                sb.Draw(Utils.white, destinationRectangle, new Rectangle?(), os.highlightColor, rotation, origin, SpriteEffects.FlipVertically, 0.6f);
                ++num3;
                rotation += num2;
            }
            if (!drawLoadingText)
            {
                return;
            }
            TextItem.doFontLabelToSize(new Rectangle(bounds.X, bounds.Y + 20, bounds.Width, 30), LocaleTerms.Loc("Loading..."), GuiData.font, Utils.AddativeWhite, false, false);
        }