Ejemplo n.º 1
0
    public static void Show(string[] menuItemsCaptions = null, float delay = 0)
    {
        Hide();

        if (menuItemsCaptions != null)
        {
            CurrentMenuSet = menuItemsCaptions;
        }

        panel = PanelWithChildren.Create <SelectableTextList> ();
        panel.gameObject.name    = "panel_MainMenu";
        panel.DelayBeforeShowing = delay;
        panel.Initialize(CurrentMenuSet);

        Utils.ProvideCanvas(panel.gameObject);
        RectTransform rt = panel.gameObject.transform as RectTransform;

        rt.SetParent(Design.visibleArea.transform);
        rt.offsetMin = offsetMin;
        rt.offsetMax = rt.offsetMin + new Vector2(itemSize.x, itemSize.y * panel.itemCount);

        panel.SetAligner_FixedTile(itemSize);
        panel.alignDirection = Aligner.AlignDirection.adTop;
        panel.Rebuild();

        panel.OnSelectItem = new UnityAction <string> (ExecuteAction);
    }
Ejemplo n.º 2
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            ScreenManager.FadeBackBufferToBlack(byte.MaxValue);
            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(999, 10, 10, 200, 30, "<- Back", Color.Gray))
            {
                SettingsLoader.writeStatusFile();
                ExitScreen();
            }
            TextItem.doLabel(new Vector2(400f, 65f), "Resolutions", new Color?());
            var num = currentResIndex;

            currentResIndex = SelectableTextList.doFancyList(10, 400, 100, 200, 450, resolutions, currentResIndex,
                                                             new Color?(), false);
            if (!mouseHasBeenReleasedOnThisScreen)
            {
                currentResIndex = num;
            }
            else if (SelectableTextList.wasActivated)
            {
                resolutionChanged = true;
            }
            TextItem.doLabel(new Vector2(100f, 64f), "Fullscreen", new Color?());
            windowed = CheckBox.doCheckBox(20, 100, 100, windowed, new Color?());
            TextItem.doLabel(new Vector2(100f, 124f), "Bloom", new Color?());
            PostProcessor.bloomEnabled = CheckBox.doCheckBox(21, 100, 160, PostProcessor.bloomEnabled, new Color?());
            TextItem.doLabel(new Vector2(100f, 184f), "Scanlines", new Color?());
            PostProcessor.scanlinesEnabled = CheckBox.doCheckBox(22, 100, 220, PostProcessor.scanlinesEnabled,
                                                                 new Color?());
            TextItem.doLabel(new Vector2(100f, 244f), "Sound Enabled", new Color?());
            MusicManager.setIsMuted(!CheckBox.doCheckBox(23, 100, 280, !MusicManager.isMuted, new Color?()));
            TextItem.doLabel(new Vector2(100f, 305f), "Music Volume", new Color?());
            MusicManager.setVolume(SliderBar.doSliderBar(24, 100, 350, 210, 30, 1f, 0.0f, MusicManager.getVolume(),
                                                         1.0f / 1000.0f));
            TextItem.doLabel(new Vector2(100f, 384f), "Text Size", new Color?());
            currentFontIndex = SelectableTextList.doFancyList(25, 100, 414, 200, 160, fontConfigs, currentFontIndex,
                                                              new Color?(), false);
            if (Button.doButton(990, 10, ScreenManager.GraphicsDevice.Viewport.Height - 120, 200, 30, "Apply Changes",
                                Color.LightBlue))
            {
                needsApply = true;
            }
            GuiData.endDraw();
            PostProcessor.end();
        }
Ejemplo n.º 3
0
        public static void DrawMenu(ModManager.ModEntry modEntry, object[] param)
        {
            if (param == null || param.Length <= 1)
            {
                return;
            }
            if (param.Length == 2 && !((param[1] is Vector2) || (param[1] is Vector4)))
            {
                return;
            }
            if (!(param[0] is ScreenManager))
            {
                return;
            }
            ScreenManager screenManager = (ScreenManager)param[0];
            Vector4       ranged;

            if (param[1] is Vector2)
            {
                ranged = new Vector4((Vector2)param[1], screenManager.GraphicsDevice.Viewport.Width - ((Vector2)param[1]).X - 55, screenManager.GraphicsDevice.Viewport.Height - ((Vector2)param[1]).Y - 55);
            }
            else if (param[1] is Vector4)
            {
                ranged = (Vector4)param[1];
            }
            else if ((param[1] is int) && param.Length >= 3 && param.Length != 4)
            {
                int x = (int)param[1];
                int y = (int)param[2];

                int w = screenManager.GraphicsDevice.Viewport.Width - x - 55;
                int h = screenManager.GraphicsDevice.Viewport.Height - y - 55;

                if (param.Length == 5)
                {
                    w = (int)param[3];
                    h = (int)param[4];
                }

                ranged = new Vector4(x, y, w, h);
            }
            else
            {
                return;
            }

            TextItem.doMeasuredSmallLabel(new Vector2(ranged.X + 25, ranged.Y + 25), "ModsCore.Settings.FontName".Translate(), Color.White);
            settings.CurFont = SelectableTextList.doFancyList((modEntry.Info.Id + "FontName").GetHashCode(), (int)ranged.X, (int)ranged.Y + 50, (int)ranged.Z - 50, (int)ranged.W - 50, Main.FontName.ToArray(), settings.CurFont, Color.White);
        }
Ejemplo n.º 4
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            var text = new string[records.files.Count];

            for (var index = 0; index < records.files.Count; ++index)
            {
                try
                {
                    text[index] =
                        records.files[index].name.Substring(0, records.files[index].name.IndexOf('['))
                        .Replace("_", ", ");
                }
                catch (Exception ex)
                {
                    text[index] = "UNKNOWN" + index;
                }
            }
            var width = bounds.Width / 3;
            var num   = SelectedIndex;

            SelectedIndex = SelectableTextList.doFancyList(832190831, bounds.X + 1, bounds.Y + 4, width,
                                                           bounds.Height - 8, text, SelectedIndex, themeColor, true);
            if (SelectedIndex != num)
            {
                recordScrollPosition = Vector2.Zero;
            }
            sb.Draw(Utils.white, new Rectangle(bounds.X + width - 1, bounds.Y + 1, 2, bounds.Height - 2), themeColor);
            var entry   = new DeathRowEntry();
            var bounds1 = bounds;

            bounds1.X     += width;
            bounds1.Width -= width + 1;
            if (SelectedIndex >= 0 && SelectedIndex < records.files.Count)
            {
                entry = ConvertStringToRecord(records.files[SelectedIndex].data);
            }
            if (entry.RecordNumber != null)
            {
                DrawRecord(bounds1, sb, entry);
            }
            else
            {
                DrawTitleScreen(bounds1, sb);
            }
        }
Ejemplo n.º 5
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            string[] text = new string[this.records.files.Count];
            for (int index = 0; index < this.records.files.Count; ++index)
            {
                try
                {
                    text[index] = this.records.files[index].name.Substring(0, this.records.files[index].name.IndexOf('[')).Replace("_", ", ");
                }
                catch (Exception ex)
                {
                    text[index] = "UNKNOWN" + (object)index;
                }
            }
            int width         = bounds.Width / 3;
            int selectedIndex = this.SelectedIndex;

            this.SelectedIndex = SelectableTextList.doFancyList(832190831, bounds.X + 1, bounds.Y + 4, width, bounds.Height - 8, text, this.SelectedIndex, new Color?(this.themeColor), true);
            if (this.SelectedIndex != selectedIndex)
            {
                this.recordScrollPosition = Vector2.Zero;
            }
            sb.Draw(Utils.white, new Rectangle(bounds.X + width - 1, bounds.Y + 1, 2, bounds.Height - 2), this.themeColor);
            DeathRowDatabaseDaemon.DeathRowEntry entry = new DeathRowDatabaseDaemon.DeathRowEntry();
            Rectangle bounds1 = bounds;

            bounds1.X     += width;
            bounds1.Width -= width + 1;
            if (this.SelectedIndex >= 0 && this.SelectedIndex < this.records.files.Count)
            {
                entry = this.ConvertStringToRecord(this.records.files[this.SelectedIndex].data);
            }
            if (entry.RecordNumber != null)
            {
                this.DrawRecord(bounds1, sb, entry);
            }
            else
            {
                this.DrawTitleScreen(bounds1, sb);
            }
        }
Ejemplo n.º 6
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue);
            GuiData.startDraw();
            int      x        = 0;
            int      y        = 0;
            Viewport viewport = this.ScreenManager.GraphicsDevice.Viewport;
            int      width    = viewport.Width;

            viewport = this.ScreenManager.GraphicsDevice.Viewport;
            int height = viewport.Height;

            PatternDrawer.draw(new Rectangle(x, y, width, height), 0.5f, Color.Black, new Color(2, 2, 2), GuiData.spriteBatch);
            if (Button.doButton(999, 10, 10, 220, 30, "<- " + LocaleTerms.Loc("Back"), new Color?(Color.Gray)))
            {
                SettingsLoader.writeStatusFile();
                this.ExitScreen();
            }
            if (Button.doButton(9907, 10, 44, 220, 20, LocaleTerms.Loc("Apply Changes"), new Color?(Color.LightBlue)))
            {
                this.needsApply = true;
            }
            int num1 = 100;

            TextItem.doLabel(new Vector2(400f, (float)num1), LocaleTerms.Loc("Resolutions"), new Color?(), 200f);
            int currentResIndex = this.currentResIndex;

            this.currentResIndex = SelectableTextList.doFancyList(10, 400, num1 + 36, 200, 450, this.resolutions, this.currentResIndex, new Color?(), false);
            if (!this.mouseHasBeenReleasedOnThisScreen)
            {
                this.currentResIndex = currentResIndex;
            }
            else if (SelectableTextList.wasActivated)
            {
                this.resolutionChanged = true;
            }
            if (!this.startedFromGameContext)
            {
                TextItem.doLabel(new Vector2(620f, (float)num1), LocaleTerms.Loc("Language"), new Color?(), 200f);
                int currentLocaleIndex = this.currentLocaleIndex;
                this.currentLocaleIndex = SelectableTextList.doFancyList(1013, 620, num1 + 36, 200, 450, this.localeNames, this.currentLocaleIndex, new Color?(), false);
                if (!this.mouseHasBeenReleasedOnThisScreen)
                {
                    this.currentLocaleIndex = currentLocaleIndex;
                }
                else if (SelectableTextList.wasActivated)
                {
                    LocaleActivator.ActivateLocale(LocaleActivator.SupportedLanguages[this.currentLocaleIndex].Code, Game1.getSingleton().Content);
                    Settings.ActiveLocale = LocaleActivator.SupportedLanguages[this.currentLocaleIndex].Code;
                }
            }
            int   num2     = 64;
            float MaxWidth = 280f;
            int   num3;

            TextItem.doLabel(new Vector2(100f, (float)(num3 = num2 + 36)), LocaleTerms.Loc("Fullscreen"), new Color?(), MaxWidth);
            int num4;

            this.windowed = CheckBox.doCheckBox(20, 100, num4 = num3 + 34, this.windowed, new Color?());
            int num5;

            TextItem.doLabel(new Vector2(100f, (float)(num5 = num4 + 32)), LocaleTerms.Loc("Bloom"), new Color?(), MaxWidth);
            int num6;

            PostProcessor.bloomEnabled = CheckBox.doCheckBox(21, 100, num6 = num5 + 34, PostProcessor.bloomEnabled, new Color?());
            int num7;

            TextItem.doLabel(new Vector2(100f, (float)(num7 = num6 + 32)), LocaleTerms.Loc("Scanlines"), new Color?(), MaxWidth);
            int num8;

            PostProcessor.scanlinesEnabled = CheckBox.doCheckBox(22, 100, num8 = num7 + 34, PostProcessor.scanlinesEnabled, new Color?());
            int num9;

            TextItem.doLabel(new Vector2(100f, (float)(num9 = num8 + 32)), LocaleTerms.Loc("Multisampling"), new Color?(), MaxWidth);
            bool shouldMultisample = SettingsLoader.ShouldMultisample;
            int  num10;

            SettingsLoader.ShouldMultisample = CheckBox.doCheckBox(221, 100, num10 = num9 + 34, SettingsLoader.ShouldMultisample, new Color?());
            if (shouldMultisample != SettingsLoader.ShouldMultisample)
            {
                this.resolutionChanged = true;
            }
            int num11;

            TextItem.doLabel(new Vector2(100f, (float)(num11 = num10 + 32)), LocaleTerms.Loc("Audio Visualiser"), new Color?(), MaxWidth);
            int num12;

            SettingsLoader.ShouldDrawMusicVis = CheckBox.doCheckBox(223, 100, num12 = num11 + 34, SettingsLoader.ShouldDrawMusicVis, new Color?());
            int num13;

            TextItem.doLabel(new Vector2(100f, (float)(num13 = num12 + 32)), LocaleTerms.Loc("Sound Enabled"), new Color?(), MaxWidth);
            int num14;

            MusicManager.setIsMuted(!CheckBox.doCheckBox(23, 100, num14 = num13 + 34, !MusicManager.isMuted, new Color?()));
            int num15;

            TextItem.doLabel(new Vector2(100f, (float)(num15 = num14 + 32)), LocaleTerms.Loc("Music Volume"), new Color?(), MaxWidth);
            int num16;

            MusicManager.setVolume(SliderBar.doSliderBar(24, 100, num16 = num15 + 34, 210, 30, 1f, 0.0f, MusicManager.getVolume(), 1f / 1000f));
            int num17;

            TextItem.doLabel(new Vector2(100f, (float)(num17 = num16 + 32)), LocaleTerms.Loc("Text Size"), new Color?(), MaxWidth);
            int currentFontIndex = this.currentFontIndex;
            int num18;

            this.currentFontIndex = SelectableTextList.doFancyList(25, 100, num18 = num17 + 34, 200, 160, this.fontConfigs, this.currentFontIndex, new Color?(), false);
            if (this.currentFontIndex != currentFontIndex && this.startedFromGameContext)
            {
                try
                {
                    if (OS.currentInstance != null)
                    {
                        OS.currentInstance.terminal.reset();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine((object)ex);
                    Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                }
            }
            if (Button.doButton(990, 10, num18 + 150, 220, 30, LocaleTerms.Loc("Apply Changes"), new Color?(Color.LightBlue)))
            {
                this.needsApply = true;
            }
            GuiData.endDraw();
            PostProcessor.end();
        }
Ejemplo n.º 7
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.º 8
0
        private void DrawListing(Rectangle dest, SpriteBatch sb)
        {
            this.DrawHeaders(dest, sb);
            if (this.isExiting)
            {
                return;
            }
            Vector2 pos = new Vector2((float)(dest.X + 2), (float)dest.Y + 60f);

            TextItem.doFontLabel(pos, LocaleTerms.Loc("Remote"), GuiData.smallfont, new Color?(this.themeColor), (float)(this.bounds.Width - 20), 20f, false);
            pos.Y += 18f;
            sb.Draw(Utils.white, new Rectangle(this.bounds.X + 2, (int)pos.Y, this.bounds.Width - 6, 1), Utils.AddativeWhite);
            List <string> stringList1   = new List <string>();
            Folder        currentFolder = Programs.getCurrentFolder(this.os);

            for (int index = 0; index < currentFolder.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(currentFolder.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    stringList1.Add(currentFolder.files[index].name);
                }
            }
            string    str = (string)null;
            string    selectedFileData = (string)null;
            Color     color            = Color.Lerp(this.os.topBarColor, Utils.AddativeWhite, 0.2f);
            int       scrollOffset     = SelectableTextList.scrollOffset;
            Rectangle rectangle1       = new Rectangle((int)pos.X, (int)pos.Y, this.bounds.Width - 6, 54);

            if (stringList1.Count > 0)
            {
                SelectableTextList.scrollOffset = this.remoteScroll;
                this.remotesSelected            = SelectableTextList.doFancyList(8139191 + this.PID, rectangle1.X, rectangle1.Y, rectangle1.Width, rectangle1.Height, stringList1.ToArray(), this.remotesSelected, new Color?(color), true);
                if (SelectableTextList.selectionWasChanged)
                {
                    this.localsSelected = -1;
                }
                this.remoteScroll = SelectableTextList.scrollOffset;
                if (this.remotesSelected >= 0)
                {
                    if (this.remotesSelected >= stringList1.Count)
                    {
                        this.remotesSelected = -1;
                    }
                    else
                    {
                        str = stringList1[this.remotesSelected];
                        selectedFileData = currentFolder.searchForFile(str).data;
                    }
                }
            }
            else
            {
                sb.Draw(Utils.white, rectangle1, Utils.VeryDarkGray);
                TextItem.doFontLabelToSize(rectangle1, "    -- " + LocaleTerms.Loc("No Valid Files") + " --    ", GuiData.smallfont, Utils.AddativeWhite, false, false);
            }
            pos.Y += (float)(rectangle1.Height + 6);
            TextItem.doFontLabel(pos, LocaleTerms.Loc("Local Theme Files"), GuiData.smallfont, new Color?(this.themeColor), (float)(this.bounds.Width - 20), 20f, false);
            pos.Y += 18f;
            sb.Draw(Utils.white, new Rectangle(this.bounds.X + 2, (int)pos.Y, this.bounds.Width - 6, 1), Utils.AddativeWhite);
            stringList1.Clear();
            List <string> stringList2 = new List <string>();
            Folder        folder1     = this.os.thisComputer.files.root.searchForFolder("sys");

            for (int index = 0; index < folder1.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(folder1.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    stringList1.Add(folder1.files[index].name);
                    stringList2.Add(folder1.files[index].data);
                }
            }
            Folder folder2 = this.os.thisComputer.files.root.searchForFolder("home");

            for (int index = 0; index < folder2.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(folder2.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    stringList1.Add(folder2.files[index].name);
                    stringList2.Add(folder2.files[index].data);
                }
            }
            Rectangle rectangle2 = new Rectangle((int)pos.X, (int)pos.Y, this.bounds.Width - 6, 72);

            if (stringList1.Count > 0)
            {
                SelectableTextList.scrollOffset = this.localScroll;
                this.localsSelected             = SelectableTextList.doFancyList(839192 + this.PID, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, stringList1.ToArray(), this.localsSelected, new Color?(color), true);
                if (SelectableTextList.selectionWasChanged)
                {
                    this.remotesSelected = -1;
                }
                this.localScroll = SelectableTextList.scrollOffset;
                if (this.localsSelected >= 0)
                {
                    str = stringList1[this.localsSelected];
                    selectedFileData = stringList2[this.localsSelected];
                }
            }
            else
            {
                sb.Draw(Utils.white, rectangle2, Utils.VeryDarkGray);
                TextItem.doFontLabelToSize(rectangle2, "    -- " + LocaleTerms.Loc("No Valid Files") + " --    ", GuiData.smallfont, Utils.AddativeWhite, false, false);
            }
            SelectableTextList.scrollOffset = scrollOffset;
            pos.Y += (float)(rectangle2.Height + 2);
            Rectangle bounds = new Rectangle(this.bounds.X + 4, (int)pos.Y + 2, this.bounds.Width - 8, (int)((double)dest.Height - ((double)pos.Y - (double)dest.Y)) - 4);

            this.DrawApplyField(str, selectedFileData, bounds, sb);
        }
Ejemplo n.º 9
0
        private void DrawListing(Rectangle dest, SpriteBatch sb)
        {
            DrawHeaders(dest, sb);
            if (isExiting)
            {
                return;
            }
            var pos = new Vector2(dest.X + 2, dest.Y + 60f);

            TextItem.doFontLabel(pos, "Remote", GuiData.smallfont, themeColor, this.bounds.Width - 20, 20f);
            pos.Y += 18f;
            sb.Draw(Utils.white, new Rectangle(this.bounds.X + 2, (int)pos.Y, this.bounds.Width - 6, 1),
                    Utils.AddativeWhite);
            var list1         = new List <string>();
            var currentFolder = Programs.getCurrentFolder(os);

            for (var index = 0; index < currentFolder.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(currentFolder.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    list1.Add(currentFolder.files[index].name);
                }
            }
            string str = null;
            string selectedFileData = null;
            var    color            = Color.Lerp(os.topBarColor, Utils.AddativeWhite, 0.2f);
            var    num        = SelectableTextList.scrollOffset;
            var    rectangle1 = new Rectangle((int)pos.X, (int)pos.Y, this.bounds.Width - 6, 54);

            if (list1.Count > 0)
            {
                SelectableTextList.scrollOffset = remoteScroll;
                remotesSelected = SelectableTextList.doFancyList(8139191 + PID, rectangle1.X, rectangle1.Y,
                                                                 rectangle1.Width, rectangle1.Height, list1.ToArray(), remotesSelected, color, true);
                if (SelectableTextList.selectionWasChanged)
                {
                    localsSelected = -1;
                }
                remoteScroll = SelectableTextList.scrollOffset;
                if (remotesSelected >= 0)
                {
                    if (remotesSelected >= list1.Count)
                    {
                        remotesSelected = -1;
                    }
                    else
                    {
                        str = list1[remotesSelected];
                        selectedFileData = currentFolder.searchForFile(str).data;
                    }
                }
            }
            else
            {
                sb.Draw(Utils.white, rectangle1, Utils.VeryDarkGray);
                TextItem.doFontLabelToSize(rectangle1, "    -- No Valid Files --    ", GuiData.smallfont,
                                           Utils.AddativeWhite);
            }
            pos.Y += rectangle1.Height + 6;
            TextItem.doFontLabel(pos, "Local Theme Files", GuiData.smallfont, themeColor, this.bounds.Width - 20, 20f);
            pos.Y += 18f;
            sb.Draw(Utils.white, new Rectangle(this.bounds.X + 2, (int)pos.Y, this.bounds.Width - 6, 1),
                    Utils.AddativeWhite);
            list1.Clear();
            var list2   = new List <string>();
            var folder1 = os.thisComputer.files.root.searchForFolder("sys");

            for (var index = 0; index < folder1.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(folder1.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    list1.Add(folder1.files[index].name);
                    list2.Add(folder1.files[index].data);
                }
            }
            var folder2 = os.thisComputer.files.root.searchForFolder("home");

            for (var index = 0; index < folder2.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(folder2.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    list1.Add(folder2.files[index].name);
                    list2.Add(folder2.files[index].data);
                }
            }
            var rectangle2 = new Rectangle((int)pos.X, (int)pos.Y, this.bounds.Width - 6, 72);

            if (list1.Count > 0)
            {
                SelectableTextList.scrollOffset = localScroll;
                localsSelected = SelectableTextList.doFancyList(839192 + PID, rectangle2.X, rectangle2.Y,
                                                                rectangle2.Width, rectangle2.Height, list1.ToArray(), localsSelected, color, true);
                if (SelectableTextList.selectionWasChanged)
                {
                    remotesSelected = -1;
                }
                localScroll = SelectableTextList.scrollOffset;
                if (localsSelected >= 0)
                {
                    str = list1[localsSelected];
                    selectedFileData = list2[localsSelected];
                }
            }
            else
            {
                sb.Draw(Utils.white, rectangle2, Utils.VeryDarkGray);
                TextItem.doFontLabelToSize(rectangle2, "    -- No Valid Files --    ", GuiData.smallfont,
                                           Utils.AddativeWhite);
            }
            SelectableTextList.scrollOffset = num;
            pos.Y += rectangle2.Height + 2;
            var bounds = new Rectangle(this.bounds.X + 4, (int)pos.Y + 2, this.bounds.Width - 8,
                                       (int)(dest.Height - (pos.Y - (double)dest.Y)) - 4);

            DrawApplyField(str, selectedFileData, bounds, sb);
        }