コード例 #1
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
        private void doMenuScreen(Rectangle bounds, SpriteBatch sb)
        {
            Rectangle rectangle = new Rectangle(bounds.X + 10, bounds.Y + bounds.Height / 3 + 10, bounds.Width / 2, 40);

            if (Button.doButton(101010, rectangle.X + this.getTransitionOffset(0), rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("Contract Listing"), new Color?(this.themeColor)))
            {
                this.state            = MissionHubServer.HubState.Listing;
                this.screenTransition = 1f;
            }
            rectangle.Y += rectangle.Height + 5;
            if (Button.doButton(101015, rectangle.X + this.getTransitionOffset(1), rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("User List"), new Color?(this.themeColor)))
            {
                this.state            = MissionHubServer.HubState.UserList;
                this.screenTransition = 1f;
            }
            rectangle.Y += rectangle.Height + 5;
            if (this.allowAbandon)
            {
                if (Button.doButton(101017, rectangle.X + this.getTransitionOffset(1), rectangle.Y, rectangle.Width, rectangle.Height / 2, LocaleTerms.Loc("Abort Current Contract"), new Color?(this.os.currentMission == null ? Color.Black : this.themeColor)) && this.os.currentMission != null)
                {
                    this.state            = MissionHubServer.HubState.CancelContract;
                    this.screenTransition = 1f;
                }
                rectangle.Y += rectangle.Height / 2 + 5;
            }
            if (Button.doButton(102015, rectangle.X + this.getTransitionOffset(3), rectangle.Y, rectangle.Width, rectangle.Height / 2, LocaleTerms.Loc("Exit"), new Color?(this.os.lockedColor)))
            {
                this.os.display.command = "connect";
            }
            rectangle.Y += rectangle.Height + 5;
        }
コード例 #2
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
        private void doUserListScreen(Rectangle bounds, SpriteBatch sb)
        {
            if (Button.doButton(101801, bounds.X + 2, bounds.Y + 20, bounds.Width / 4, 22, LocaleTerms.Loc("Back"), new Color?(this.themeColor)))
            {
                this.state = MissionHubServer.HubState.Menu;
            }
            Rectangle rectangle = new Rectangle(bounds.X + 30, bounds.Y + 50, bounds.Width / 2, 30);
            int       num1      = 18 + rectangle.Height - 8;
            int       num2      = (bounds.Height - 90) / num1;
            int       num3      = num2 * this.userListPageNumber;
            int       num4      = 0;

            for (int index1 = num2 * this.userListPageNumber; index1 < this.usersFolder.files.Count && index1 < num3 + num2; ++index1)
            {
                string[] strArray = this.usersFolder.files[index1].data.Split(Utils.newlineDelim);
                string   str1;
                string   str2 = str1 = "";
                string   str3 = str1;
                string   str4 = str1;
                string   str5 = str1;
                for (int index2 = 0; index2 < strArray.Length; ++index2)
                {
                    if (strArray[index2].StartsWith("USER"))
                    {
                        str5 = this.getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Rank"))
                    {
                        str2 = this.getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Handle"))
                    {
                        str4 = this.getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Date"))
                    {
                        str3 = this.getDataFromConfigLine(strArray[index2], ": ");
                    }
                }
                Rectangle destinationRectangle = new Rectangle(rectangle.X + (bounds.Width - 60) - 10, rectangle.Y + 2, rectangle.Height + 1, bounds.Width - 60);
                GuiData.spriteBatch.Draw(Utils.gradient, destinationRectangle, new Rectangle?(), this.themeColorLine, 1.570796f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0.8f);
                TextItem.doSmallLabel(new Vector2((float)rectangle.X, (float)rectangle.Y), "#" + str5 + " - \"" + str4 + "\" Rank:" + str2, new Color?());
                rectangle.Y += 18;
                TextItem.doFontLabel(new Vector2((float)rectangle.X, (float)rectangle.Y), string.Format(LocaleTerms.Loc("Joined {0}"), (object)str3), GuiData.detailfont, new Color?(), float.MaxValue, float.MaxValue, false);
                rectangle.Y += rectangle.Height - 10;
                num4         = index1;
            }
            rectangle.Y += 16;
            if (this.userListPageNumber > 0 && Button.doButton(101005, rectangle.X, rectangle.Y, rectangle.Width / 2 - 20, 15, LocaleTerms.Loc("Previous Page"), new Color?()))
            {
                --this.userListPageNumber;
            }
            TextItem.doTinyLabel(new Vector2((float)(rectangle.X + rectangle.Width / 2 - 8), (float)rectangle.Y), string.Concat((object)this.userListPageNumber), new Color?());
            if (this.usersFolder.files.Count <= num4 + 1 || !Button.doButton(101010, rectangle.X + rectangle.Width / 2 + 10, rectangle.Y, rectangle.Width / 2 - 10, 15, LocaleTerms.Loc("Next Page"), new Color?()))
            {
                return;
            }
            ++this.userListPageNumber;
        }
コード例 #3
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
 public override void userLoggedIn()
 {
     base.userLoggedIn();
     this.activeUserName      = this.user.name;
     this.state               = MissionHubServer.HubState.Menu;
     this.screenTransition    = 1f;
     this.activeUserLoginTime = DateTime.Now;
 }
コード例 #4
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
        private void doContractPreviewScreen(Rectangle bounds, SpriteBatch sb)
        {
            string stringForContractFile = this.getIDStringForContractFile(this.listingsFolder.files[this.selectedElementIndex]);

            if (!this.listingMissions.ContainsKey(stringForContractFile))
            {
                return;
            }
            ActiveMission listingMission = this.listingMissions[stringForContractFile];
            Vector2       vector2        = new Vector2((float)(bounds.X + 20), (float)(bounds.Y + 20));

            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(0), 0.0f), "CONTRACT:" + stringForContractFile, GuiData.titlefont, new Color?(), (float)(bounds.Width / 2), 40f, false);
            vector2.Y += 40f;
            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(1), 0.0f), listingMission.postingTitle.Replace("#", ""), GuiData.font, new Color?(), (float)(bounds.Width - 30), float.MaxValue, false);
            vector2.Y += 30f;
            string        str           = DisplayModule.cleanSplitForWidth(listingMission.postingBody, bounds.Width - 110);
            StringBuilder stringBuilder = new StringBuilder();
            int           num1          = (int)((double)(((float)bounds.Width - 20f) / GuiData.smallfont.MeasureString("-").X) / 2.0);

            for (int index = 1; index < num1 - 5; ++index)
            {
                stringBuilder.Append("-");
            }
            string text = str.Replace("###", stringBuilder.ToString());

            if (LocaleActivator.ActiveLocaleIsCJK())
            {
                text       = Utils.SuperSmartTwimForWidth(listingMission.postingBody, bounds.Width - 110, GuiData.smallfont);
                vector2.Y += 20f;
            }
            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(2), 0.0f), text, GuiData.smallfont, new Color?(), (float)(bounds.Width - 20), float.MaxValue, false);
            int num2 = Math.Max(135, bounds.Height / 6);

            if (Button.doButton(2171618, bounds.X + 20 + this.getTransitionOffset(3), bounds.Y + bounds.Height - num2, bounds.Width / 5, 30, LocaleTerms.Loc("Back"), new Color?()))
            {
                this.state            = MissionHubServer.HubState.Listing;
                this.screenTransition = 1f;
            }
            if (this.os.currentMission == null)
            {
                if (Button.doButton(2171615, bounds.X + 20 + this.getTransitionOffset(4), bounds.Y + bounds.Height - num2 - 40, bounds.Width / 5, 30, LocaleTerms.Loc("Accept"), new Color?(this.os.highlightColor)))
                {
                    this.acceptMission(listingMission, this.selectedElementIndex, stringForContractFile);
                    this.state            = MissionHubServer.HubState.Listing;
                    this.screenTransition = 1f;
                }
            }
            else
            {
                TextItem.doFontLabelToSize(new Rectangle(bounds.X + 20 + this.getTransitionOffset(4), bounds.Y + bounds.Height - num2 - 40, bounds.Width / 2, 30), LocaleTerms.Loc("Abort current contract to accept new ones."), GuiData.smallfont, Color.White, false, false);
            }
        }
コード例 #5
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
 public override void navigatedTo()
 {
     base.navigatedTo();
     this.screenTransition      = 1f;
     this.state                 = MissionHubServer.HubState.Welcome;
     this.missionListPageNumber = 0;
     if (this.thinBarcodeTop != null)
     {
         this.thinBarcodeTop.regenerate();
     }
     if (this.thinBarcodeBot != null)
     {
         this.thinBarcodeBot.regenerate();
     }
     this.CheckForGameStateIssuesAndFix();
 }
コード例 #6
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
        private void drawWelcomeScreen(Rectangle bounds, SpriteBatch sb)
        {
            Rectangle rectangle = new Rectangle(bounds.X + 10, bounds.Y + bounds.Height / 3 - 10, bounds.Width / 2, 30);
            string    upper     = string.Format("{0} Contract Hub", (object)this.groupName).ToUpper();

            TextItem.doFontLabel(new Vector2((float)rectangle.X, (float)rectangle.Y), upper, GuiData.titlefont, new Color?(), (float)bounds.Width / 0.6f, 50f, false);
            rectangle.Y += 50;
            if (Button.doButton(11005, rectangle.X + this.getTransitionOffset(0), rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("Login"), new Color?(this.themeColor)))
            {
                this.startLogin();
                this.state = MissionHubServer.HubState.Login;
            }
            rectangle.Y += rectangle.Height + 5;
            if (!Button.doButton(12010, rectangle.X + this.getTransitionOffset(1), rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("Exit"), new Color?(this.themeColor)))
            {
                return;
            }
            this.os.display.command = "connect";
        }
コード例 #7
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
        private void doCancelContractScreen(Rectangle bounds, SpriteBatch sb)
        {
            Rectangle rectangle = new Rectangle(bounds.X + 10, bounds.Y + bounds.Height / 3 + 10, bounds.Width / 2, 40);

            TextItem.doFontLabel(new Vector2((float)rectangle.X, (float)rectangle.Y), LocaleTerms.Loc("Are you sure you with to abandon your current contract?") + "\n" + LocaleTerms.Loc("This cannot be reversed."), GuiData.font, new Color?(Color.White), (float)(bounds.Width - 30), (float)rectangle.Height, false);
            rectangle.Y += rectangle.Height + 4;
            if (Button.doButton(142011, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("Abandon Contract"), new Color?(Color.Red)) && this.os.currentMission != null)
            {
                this.os.currentMission = (ActiveMission)null;
                this.os.currentFaction.contractAbbandoned((object)this.os);
                this.screenTransition = 0.0f;
                this.state            = MissionHubServer.HubState.Menu;
                this.CheckForGameStateIssuesAndFix();
            }
            rectangle.Y += rectangle.Height + 10;
            if (!Button.doButton(142015, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("Back"), new Color?(this.themeColor)))
            {
                return;
            }
            this.screenTransition = 1f;
            this.state            = MissionHubServer.HubState.Menu;
        }
コード例 #8
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
        private Rectangle doListingScreenBackground(Rectangle bounds, SpriteBatch sb)
        {
            Rectangle destinationRectangle1 = new Rectangle(bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2);

            sb.Draw(Utils.white, destinationRectangle1, this.themeColorBackground);
            this.doLoggedInScreenDetailing(bounds, sb);
            destinationRectangle1.Height = 5;
            destinationRectangle1.Width  = 0;
            destinationRectangle1.Y     += 12;
            if (this.thinBarcodeTop == null)
            {
                this.thinBarcodeTop = new ThinBarcode(bounds.Width - 4, 5);
            }
            if (this.thinBarcodeBot == null)
            {
                this.thinBarcodeBot = new ThinBarcode(bounds.Width - 4, 5);
            }
            this.thinBarcodeTop.Draw(sb, destinationRectangle1.X, destinationRectangle1.Y, this.themeColor);
            TextItem.doFontLabel(new Vector2((float)(bounds.X + 20), (float)(destinationRectangle1.Y + 10)), "MISSION LISTING", GuiData.titlefont, new Color?(this.themeColor), (float)(bounds.Width - 40), 35f, false);
            destinationRectangle1.Y += 45;
            destinationRectangle1.X  = bounds.X + 1;
            this.thinBarcodeBot.Draw(sb, destinationRectangle1.X, destinationRectangle1.Y, this.themeColor);
            destinationRectangle1.Y     += 10;
            destinationRectangle1.X      = bounds.X + 1;
            destinationRectangle1.Width  = this.decorationPanel.Width;
            destinationRectangle1.Height = this.decorationPanel.Height;
            sb.Draw(this.decorationPanel, destinationRectangle1, this.themeColor);
            destinationRectangle1.X    += destinationRectangle1.Width;
            destinationRectangle1.Width = bounds.Width - 2 - destinationRectangle1.Width;
            sb.Draw(this.decorationPanelSide, destinationRectangle1, this.themeColor);
            Vector2   pos    = new Vector2((float)(bounds.X + 6), (float)(destinationRectangle1.Y + this.decorationPanel.Height / 2 - 8));
            int       height = (int)((double)this.decorationPanel.Height * 0.300000011920929);
            float     num1   = (float)(((double)this.decorationPanel.Height - (double)height) / 2.0);
            Rectangle destinationRectangle2 = new Rectangle(bounds.X + 1, (int)((double)destinationRectangle1.Y + (double)num1), this.decorationPanel.Width, height);
            Rectangle rectangle             = new Rectangle(0, (int)(((double)this.decorationPanel.Height - (double)height) / 2.0), this.decorationPanel.Width, height);
            bool      outlineOnly           = Button.outlineOnly;
            bool      drawingOutline        = Button.drawingOutline;

            Button.outlineOnly    = true;
            Button.drawingOutline = false;
            int   myID  = 974748322;
            Color color = GuiData.active == myID ? Color.Black : (GuiData.hot == myID ? this.themeColorLine : this.themeColorBackground);

            sb.Draw(this.decorationPanel, destinationRectangle2, new Rectangle?(rectangle), color, 0.0f, Vector2.Zero, SpriteEffects.None, 0.6f);
            if (Button.doButton(myID, bounds.X + 1, destinationRectangle1.Y + this.decorationPanel.Height / 6 + 4, this.decorationPanel.Width - 30, (int)((double)this.decorationPanel.Height - (double)(this.decorationPanel.Height / 6) * 3.20000004768372), LocaleTerms.Loc("Back"), new Color?(Color.Transparent)))
            {
                this.screenTransition = 1f;
                this.state            = MissionHubServer.HubState.Menu;
            }
            Button.outlineOnly    = outlineOnly;
            Button.drawingOutline = drawingOutline;
            pos.X += (float)(this.decorationPanel.Width - 10);
            pos.Y += 4f;
            string text1 = LocaleTerms.Loc(this.groupName + " secure contract listing panel : Verified Connection : Token last verified") + " " + DateTime.Now.ToString();

            TextItem.doFontLabel(pos, text1, GuiData.detailfont, new Color?(this.themeColor), (float)destinationRectangle1.Width - 10f, 14f, false);
            pos.Y += 12f;
            if (this.missionListPageNumber > 0 && Button.doButton(188278101, (int)pos.X, (int)pos.Y, 45, 20, "<", new Color?()))
            {
                --this.missionListPageNumber;
                this.screenTransition = 1f;
            }
            destinationRectangle1.X += 50;
            int    num2  = this.listingsFolder.files.Count / this.missionListDisplayed + 1;
            string text2 = (this.missionListPageNumber + 1).ToString() + "/" + (object)num2;
            float  num3  = (float)(50.0 - (double)GuiData.smallfont.MeasureString(text2).X / 2.0);

            sb.DrawString(GuiData.smallfont, text2, new Vector2((float)destinationRectangle1.X + num3, (float)((int)pos.Y + 1)), Color.White);
            destinationRectangle1.X += 100;
            if (this.missionListPageNumber < num2 - 1 && Button.doButton(188278102, destinationRectangle1.X, (int)pos.Y, 45, 20, ">", new Color?()))
            {
                ++this.missionListPageNumber;
                this.screenTransition = 1f;
            }
            destinationRectangle1.Y     += this.decorationPanel.Height + 4;
            destinationRectangle1.Width  = bounds.Width - 2;
            destinationRectangle1.X      = bounds.X + 1;
            destinationRectangle1.Height = 7;
            sb.Draw(Utils.white, destinationRectangle1, this.themeColor);
            destinationRectangle1.Y += destinationRectangle1.Height;
            return(new Rectangle(bounds.X, destinationRectangle1.Y, bounds.Width, bounds.Height - bounds.Height / 12 - (destinationRectangle1.Y - bounds.Y)));
        }
コード例 #9
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
        private void drawMissionEntry(Rectangle bounds, SpriteBatch sb, ActiveMission mission, int index)
        {
            bool flag = false;

            if (mission.postingAcceptFlagRequirements != null)
            {
                for (int index1 = 0; index1 < mission.postingAcceptFlagRequirements.Length; ++index1)
                {
                    if (!this.os.Flags.HasFlag(mission.postingAcceptFlagRequirements[index1]))
                    {
                        flag = true;
                    }
                }
            }
            if (this.os.currentFaction != null && this.os.currentFaction.playerValue < mission.requiredRank)
            {
                flag = true;
            }
            int  myID           = index * 139284 + 984275 + index;
            bool outlineOnly    = Button.outlineOnly;
            bool drawingOutline = Button.drawingOutline;

            Button.outlineOnly    = true;
            Button.drawingOutline = false;
            if (GuiData.active == myID)
            {
                sb.Draw(Utils.white, bounds, Color.Black);
            }
            else if (GuiData.hot == myID)
            {
                sb.Draw(Utils.white, bounds, this.themeColor * 0.12f);
            }
            else
            {
                Color color = index % 2 == 0 ? this.themeColorLine : this.themeColorBackground;
                if (flag)
                {
                    color = Color.Lerp(color, Color.Gray, 0.25f);
                }
                sb.Draw(Utils.white, bounds, color);
            }
            if (mission.postingTitle.StartsWith("#"))
            {
                PatternDrawer.draw(bounds, 1f, Color.Transparent, Color.Black * 0.6f, sb);
            }
            if (flag)
            {
                Rectangle destinationRectangle = bounds;
                destinationRectangle.Height -= 6;
                destinationRectangle.Y      += 3;
                destinationRectangle.X      += bounds.Width - bounds.Height - 6;
                destinationRectangle.Width   = destinationRectangle.Height;
                sb.Draw(this.lockIcon, destinationRectangle, Color.White * 0.2f);
            }
            if (!flag && Button.doButton(myID, bounds.X, bounds.Y, bounds.Width, bounds.Height, "", new Color?(Color.Transparent)))
            {
                this.selectedElementIndex = index;
                this.state            = MissionHubServer.HubState.ContractPreview;
                this.screenTransition = 1f;
            }
            string text1 = mission.postingTitle.Replace("#", "") ?? "";

            TextItem.doFontLabel(new Vector2((float)(bounds.X + 1 + this.getTransitionOffset(index)), (float)(bounds.Y + 3)), text1, GuiData.smallfont, new Color?(Color.White), (float)bounds.Width, float.MaxValue, false);
            string text2 = "Target: " + mission.target + " -- Client: " + mission.client + " -- Key: " + (object)mission.generationKeys;

            TextItem.doFontLabel(new Vector2((float)(bounds.X + 1), (float)(bounds.Y + bounds.Height - 16)), text2, GuiData.detailfont, new Color?(Color.White * 0.3f), (float)bounds.Width, 13f, false);
            bounds.Y     += bounds.Height - 1;
            bounds.Height = 1;
            sb.Draw(Utils.white, bounds, this.themeColor * 0.2f);
            Button.outlineOnly    = outlineOnly;
            Button.drawingOutline = drawingOutline;
        }
コード例 #10
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
 public override void loginGoBack()
 {
     base.loginGoBack();
     this.state            = MissionHubServer.HubState.Welcome;
     this.screenTransition = 1f;
 }