Example #1
0
 public void getRenderText()
 {
     char[] chArray = new char[1] {
         '\n'
     };
     this.renderText = DisplayModule.cleanSplitForWidth(TutorialExe.feedbackSequence[this.state], 200).Split(chArray);
 }
Example #2
0
        public void getRenderText()
        {
            var chArray = new char[1]
            {
                '\n'
            };

            renderText = DisplayModule.cleanSplitForWidth(feedbackSequence[state], 200).Split(chArray);
        }
Example #3
0
        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);
            }
        }
Example #4
0
        private void doContractPreviewScreen(Rectangle bounds, SpriteBatch sb)
        {
            var stringForContractFile = getIDStringForContractFile(listingsFolder.files[selectedElementIndex]);

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

            TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(0), 0.0f),
                                 "CONTRACT:" + stringForContractFile, GuiData.titlefont, new Color?(), bounds.Width / 2, 40f);
            vector2.Y += 40f;
            TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(1), 0.0f), mission.postingTitle, GuiData.font,
                                 new Color?(), bounds.Width - 30, float.MaxValue);
            vector2.Y += 30f;
            var text = DisplayModule.cleanSplitForWidth(mission.postingBody, bounds.Width - 110);

            TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(2), 0.0f), text, GuiData.smallfont,
                                 new Color?(), bounds.Width - 20, float.MaxValue);
            var num = Math.Max(135, bounds.Height / 6);

            if (Button.doButton(2171618, bounds.X + 20 + getTransitionOffset(3), bounds.Y + bounds.Height - num,
                                bounds.Width / 5, 30, "Back", new Color?()))
            {
                state            = HubState.Listing;
                screenTransition = 1f;
            }
            if (os.currentMission == null)
            {
                if (
                    !Button.doButton(2171615, bounds.X + 20 + getTransitionOffset(4),
                                     bounds.Y + bounds.Height - num - 40, bounds.Width / 5, 30, "Accept", os.highlightColor))
                {
                    return;
                }
                acceptMission(mission, selectedElementIndex, stringForContractFile);
                state            = HubState.Listing;
                screenTransition = 1f;
            }
            else
            {
                TextItem.doFontLabelToSize(
                    new Rectangle(bounds.X + 20 + getTransitionOffset(4), bounds.Y + bounds.Height - num - 40,
                                  bounds.Width / 2, 30), "Abort current contract to accept new ones.", GuiData.smallfont,
                    Color.White);
            }
        }
Example #5
0
        public void getRenderText()
        {
            string data = AdvancedTutorial.feedbackSequence[this.state];

            char[] chArray = new char[1] {
                '\n'
            };
            string[] strArray = data.Split(this.hintButtonDelimiter, StringSplitOptions.RemoveEmptyEntries);
            if (strArray.Length > 1)
            {
                this.hintButtonText = DisplayModule.cleanSplitForWidth(strArray[1], 178).Split(chArray);
                data = strArray[0];
                this.hintTextFadeTimer = 0.0f;
            }
            else
            {
                this.hintButtonText = (string[])null;
            }
            this.renderText = Utils.SuperSmartTwimForWidth(LocalizedFileLoader.SafeFilterString(data), this.bounds.Width - 10, GuiData.tinyfont).Split(chArray);
        }
Example #6
0
        public void getRenderText()
        {
            var data    = feedbackSequence[state];
            var chArray = new char[1]
            {
                '\n'
            };
            var strArray = data.Split(hintButtonDelimiter, StringSplitOptions.RemoveEmptyEntries);

            if (strArray.Length > 1)
            {
                hintButtonText    = DisplayModule.cleanSplitForWidth(strArray[1], 178).Split(chArray);
                data              = strArray[0];
                hintTextFadeTimer = 0.0f;
            }
            else
            {
                hintButtonText = null;
            }
            renderText = Utils.SuperSmartTwimForWidth(data, bounds.Width - 10, GuiData.tinyfont).Split(chArray);
        }
Example #7
0
 public void doGui()
 {
     PatternDrawer.draw(new Rectangle(180, 160, 500, 85), 1f, darkgrey, dark_ish_gray, GuiData.spriteBatch);
     TextItem.doSmallLabel(new Vector2(200f, 170f), "IP To Connect to:", new Color?());
     destination = TextBox.doTextBox(100, 200, 200, 300, 1, destination, GuiData.smallfont);
     if (Button.doButton(123, 510, 201, 120, 23, "Connect", new Color?()) || TextBox.BoxWasActivated)
     {
         ConnectToServer(destination);
     }
     else
     {
         if (isConnecting)
         {
             drawConnectingGui();
         }
         TextItem.doLabel(new Vector2(200f, 300f), "Local IPs: " + myIP, new Color?());
         var y = 340f;
         for (var index = 0; index < allLocalIPs.Count - 1; ++index)
         {
             TextItem.doLabel(new Vector2(351f, y), allLocalIPs[index], new Color?());
             y += 40f;
         }
         TextItem.doLabel(new Vector2(200f, y + 40f), "Extrn IP: " + externalIP, new Color?());
         var pos = new Vector2(610f, 280f);
         TextItem.doLabel(pos, "Info:", new Color?());
         pos.Y += 40f;
         var text =
             DisplayModule.cleanSplitForWidth(
                 "To Begin a multiplayer session, type in the IP of the computer you want to connect to and press enter or connect. Both players must be on this screen. To connect over the internet, use the extern IP address and ensure port 3030 is open.",
                 400);
         TextItem.doFontLabel(pos, text, GuiData.tinyfont, Color.DarkGray, float.MaxValue, float.MaxValue);
         if (!Button.doButton(999, 10, 10, 200, 30, "<- Back to Menu", Color.Gray))
         {
             return;
         }
         ExitScreen();
         ScreenManager.AddScreen(new MainMenu(), ScreenManager.controllingPlayer);
     }
 }
Example #8
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            this.drawSideBar(bounds, sb);
            int num1 = (int)((double)bounds.Width / 5.0);

            bounds.Width -= num1;
            bounds.X     += num1;
            this.drawTitle(bounds, sb);
            bounds.Y      += 30;
            bounds.Height -= 30;
            switch (this.state)
            {
            case AcademicDatabaseDaemon.ADDState.Welcome:
                bool      flag = this.comp.adminIP == this.os.thisComputer.ip;
                Rectangle destinationRectangle = bounds;
                destinationRectangle.Y      = bounds.Y + 60 - 20;
                destinationRectangle.Height = 22;
                sb.Draw(Utils.white, destinationRectangle, flag ? this.themeColor : this.darkThemeColor);
                string text1 = LocaleTerms.Loc("Valid Administrator Account Detected");
                if (!flag)
                {
                    text1 = LocaleTerms.Loc("Non-Admin Account Active");
                }
                Vector2 vector2   = GuiData.smallfont.MeasureString(text1);
                Vector2 position1 = new Vector2((float)(destinationRectangle.X + destinationRectangle.Width / 2) - vector2.X / 2f, (float)destinationRectangle.Y);
                sb.DrawString(GuiData.smallfont, text1, position1, Color.Black);
                if (Button.doButton(456011, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15, bounds.Width / 2, 40, LocaleTerms.Loc("About This Server"), new Color?(this.themeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.InfoPanel;
                }
                if (Button.doButton(456001, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15 + 50, bounds.Width / 2, 40, LocaleTerms.Loc("Search Entries"), new Color?(this.themeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.Seach;
                    this.os.execute("getString Name");
                }
                if (!Button.doButton(456005, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15 + 100, bounds.Width / 2, 40, LocaleTerms.Loc("Exit"), new Color?(this.themeColor)))
                {
                    break;
                }
                this.os.display.command = "connect";
                break;

            case AcademicDatabaseDaemon.ADDState.Seach:
                this.drawSearchState(bounds, sb);
                break;

            case AcademicDatabaseDaemon.ADDState.MultiMatchSearch:
            case AcademicDatabaseDaemon.ADDState.PendingResult:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, LocaleTerms.Loc("Back"), new Color?(this.darkThemeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.Welcome;
                }
                Vector2 position2 = new Vector2((float)(bounds.X + bounds.Width / 2), (float)(bounds.Y + bounds.Height / 2));
                Vector2 origin    = new Vector2((float)(this.loadingCircle.Width / 2), (float)(this.loadingCircle.Height / 2));
                sb.Draw(this.loadingCircle, position2, new Rectangle?(), Color.White, (float)((double)this.os.timer % Math.PI * 3.0), origin, Vector2.One, SpriteEffects.None, 0.5f);
                float num2 = this.os.timer - this.searchStartTime;
                if ((this.state != AcademicDatabaseDaemon.ADDState.PendingResult || (double)num2 <= 3.59999990463257) && (this.state != AcademicDatabaseDaemon.ADDState.MultiMatchSearch || (double)num2 <= 0.699999988079071))
                {
                    break;
                }
                this.state = AcademicDatabaseDaemon.ADDState.Entry;
                this.needsDeletionConfirmation = true;
                this.doPreEntryViewSearch();
                break;

            case AcademicDatabaseDaemon.ADDState.Entry:
            case AcademicDatabaseDaemon.ADDState.EditPerson:
                this.drawEntryState(bounds, sb);
                break;

            case AcademicDatabaseDaemon.ADDState.EntryNotFound:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 20, 160, 30, LocaleTerms.Loc("Back"), new Color?(this.darkThemeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.Welcome;
                }
                if (Button.doButton(456015, bounds.X + 2, bounds.Y + 55, 160, 30, LocaleTerms.Loc("Search Again"), new Color?(this.darkThemeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.Seach;
                    this.os.execute("getString Name");
                }
                TextItem.doFontLabel(new Vector2((float)(bounds.X + 2), (float)(bounds.Y + 90)), LocaleTerms.Loc("No Entries Found"), GuiData.font, new Color?(), float.MaxValue, float.MaxValue, false);
                break;

            case AcademicDatabaseDaemon.ADDState.MultipleEntriesFound:
                this.drawMultipleEntriesState(bounds, sb);
                break;

            case AcademicDatabaseDaemon.ADDState.InfoPanel:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 30, 160, 30, LocaleTerms.Loc("Back"), new Color?(this.darkThemeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.Welcome;
                }
                Vector2 pos = new Vector2((float)(bounds.X + 20), (float)(bounds.Y + 70));
                TextItem.doFontLabel(pos, LocaleTerms.Loc("Information"), GuiData.font, new Color?(), float.MaxValue, float.MaxValue, false);
                pos.Y += 40f;
                FileEntry fileEntry = this.root.searchForFile("info.txt");
                string    text2     = "ERROR: Unhandled System.IO.FileNotFoundException\nFile \"info.txt\" was not found";
                if (fileEntry != null)
                {
                    text2 = DisplayModule.cleanSplitForWidth(fileEntry.data, bounds.Width - 80);
                }
                TextItem.DrawShadow = false;
                TextItem.doFontLabel(pos, text2, GuiData.smallfont, new Color?(), (float)(bounds.Width - 40), float.MaxValue, false);
                break;

            case AcademicDatabaseDaemon.ADDState.EditEntry:
                this.drawEditDegreeState(bounds, sb);
                break;
            }
        }
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            drawSideBar(bounds, sb);
            var num1 = (int)(bounds.Width / 5.0);

            bounds.Width -= num1;
            bounds.X     += num1;
            drawTitle(bounds, sb);
            bounds.Y      += 30;
            bounds.Height -= 30;
            switch (state)
            {
            case ADDState.Welcome:
                var flag = comp.adminIP == os.thisComputer.ip;
                var destinationRectangle = bounds;
                destinationRectangle.Y      = bounds.Y + 60 - 20;
                destinationRectangle.Height = 22;
                sb.Draw(Utils.white, destinationRectangle, flag ? themeColor : darkThemeColor);
                var text1 = "Valid Administrator Account Detected";
                if (!flag)
                {
                    text1 = "Non-Admin Account Active";
                }
                var vector2   = GuiData.smallfont.MeasureString(text1);
                var position1 = new Vector2(destinationRectangle.X + destinationRectangle.Width / 2 - vector2.X / 2f,
                                            destinationRectangle.Y);
                sb.DrawString(GuiData.smallfont, text1, position1, Color.Black);
                if (Button.doButton(456011, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15, bounds.Width / 2, 40,
                                    "About This Server", themeColor))
                {
                    state = ADDState.InfoPanel;
                }
                if (Button.doButton(456001, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15 + 50, bounds.Width / 2, 40,
                                    "Search Entries", themeColor))
                {
                    state = ADDState.Seach;
                    os.execute("getString Name");
                }
                if (
                    !Button.doButton(456005, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15 + 100, bounds.Width / 2,
                                     40, "Exit", themeColor))
                {
                    break;
                }
                os.display.command = "connect";
                break;

            case ADDState.Seach:
                drawSearchState(bounds, sb);
                break;

            case ADDState.MultiMatchSearch:
            case ADDState.PendingResult:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, "Back", darkThemeColor))
                {
                    state = ADDState.Welcome;
                }
                var position2 = new Vector2(bounds.X + bounds.Width / 2, bounds.Y = bounds.Height / 2);
                var origin    = new Vector2(loadingCircle.Width / 2, loadingCircle.Height / 2);
                sb.Draw(loadingCircle, position2, new Rectangle?(), Color.White, (float)(os.timer % Math.PI * 3.0),
                        origin, Vector2.One, SpriteEffects.None, 0.5f);
                var num2 = os.timer - searchStartTime;
                if ((state != ADDState.PendingResult || num2 <= 3.59999990463257) &&
                    (state != ADDState.MultiMatchSearch || num2 <= 0.699999988079071))
                {
                    break;
                }
                state = ADDState.Entry;
                needsDeletionConfirmation = true;
                doPreEntryViewSearch();
                break;

            case ADDState.Entry:
            case ADDState.EditPerson:
                drawEntryState(bounds, sb);
                break;

            case ADDState.EntryNotFound:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 20, 160, 30, "Back", darkThemeColor))
                {
                    state = ADDState.Welcome;
                }
                if (Button.doButton(456015, bounds.X + 2, bounds.Y + 55, 160, 30, "Search Again", darkThemeColor))
                {
                    state = ADDState.Seach;
                    os.execute("getString Name");
                }
                TextItem.doFontLabel(new Vector2(bounds.X + 2, bounds.Y + 90), "No Entries Found", GuiData.font,
                                     new Color?(), float.MaxValue, float.MaxValue);
                break;

            case ADDState.MultipleEntriesFound:
                drawMultipleEntriesState(bounds, sb);
                break;

            case ADDState.InfoPanel:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 30, 160, 30, "Back", darkThemeColor))
                {
                    state = ADDState.Welcome;
                }
                var pos = new Vector2(bounds.X + 20, bounds.Y + 70);
                TextItem.doFontLabel(pos, "Information", GuiData.font, new Color?(), float.MaxValue, float.MaxValue);
                pos.Y += 40f;
                var fileEntry = root.searchForFile("info.txt");
                var text2     = "ERROR: Unhandled System.IO.FileNotFoundException\nFile \"info.txt\" was not found";
                if (fileEntry != null)
                {
                    text2 = DisplayModule.cleanSplitForWidth(fileEntry.data, bounds.Width - 80);
                }
                TextItem.DrawShadow = false;
                TextItem.doFontLabel(pos, text2, GuiData.smallfont, new Color?(), bounds.Width - 40, float.MaxValue);
                break;

            case ADDState.EditEntry:
                drawEditDegreeState(bounds, sb);
                break;
            }
        }