// ReSharper disable once UnusedMember.Global
 public void CreateRespawnSpeedEntry(TextMenu textMenu, bool inGame)
 {
     textMenu.Add(
         new TextMenu.Slider(Dialog.Clean(DialogIds.RespawnSpeed),
                             value => value + "00%",
                             1,
                             9,
                             RespawnSpeed
                             ).Change(value => RespawnSpeed = value));
 }
 // ReSharper disable once UnusedMember.Global
 public void CreateRoomTimerEntry(TextMenu textMenu, bool inGame)
 {
     textMenu.Add(
         new TextMenu.Slider(Dialog.Clean(DialogIds.RoomTimer),
                             index => Dialog.Clean(DialogIds.Prefix + RoomTimerStrings[index]),
                             0,
                             RoomTimerStrings.Count - 1,
                             Math.Max(0, RoomTimerStrings.IndexOf(RoomTimer))
                             ).Change(index => { RoomTimerManager.Instance.SwitchRoomTimer(index); }));
 }
Пример #3
0
 private void addOptionSubMenu(TextMenu menu)
 {
     menu.Add(new TextMenuExt.OptionSubMenu("Toggle Me!").Add(
                  "Empty", null)
              .Add("Filled", new List <TextMenu.Item> {
         new TextMenu.Button("Btn"),
         new TextMenu.OnOff("OnOff", false)
     })
              );
 }
Пример #4
0
        public override void Added(Scene scene)
        {
            base.Added(scene);
            Level level = SceneAs <Level>();

            Scene.Add(terminal);

            menu = new TextMenuPlus()
            {
                DoCrop = true,
                Crop   = new Rectangle((int)Position.X, (int)Position.Y, width * 6, height * 6)
            };
            menu.Tag          = TagsExt.SubHUD;
            menu.AutoScroll   = true;
            menu.InnerContent = TextMenu.InnerContentMode.TwoColumn;
            var header = new TextMenuPlus.BetterHeader(Dialog.Clean("MadelineParty_Minigame_List_Title"))
            {
                Alignment = TextMenuPlus.TextAlignment.Left
            };

            menu.Add(header);

            GameData.Instance.GetAllMinigames(level).ForEach((lvl) => {
                menu.Add(new TextMenu.Button(Dialog.Clean("MadelineParty_Minigame_Name_" + lvl.Name))
                {
                    Selectable = false
                }.Pressed(delegate
                {
                    if (terminal.Interacting)
                    {
                        MultiplayerSingleton.Instance.Send(new MinigameStart {
                            choice = lvl.Name, gameStart = DateTime.UtcNow.AddSeconds(3).ToFileTimeUtc()
                        });
                        GameData.Instance.minigame = lvl.Name;
                        ModeManager.Instance.AfterMinigameChosen();
                    }
                }));
            });
            menu.OnCancel = terminal.EndInteraction;
            menu.Position = new Vector2(menu.Width / 2 + Position.X, Engine.Height / 2f);
            Scene.Add(menu);
        }
Пример #5
0
        public override void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot)
        {
            base.CreateModMenuSection(menu, inGame, snapshot);

            menu.Add(new TextMenu.Button("modoptions_celestetas_reload".DialogCleanOrNull() ?? "Reload Settings").Pressed(() =>
            {
                LoadSettings();
                OnInputDeregister();
                OnInputInitialize();
            }));
        }
 public void CreateConnectEntry(TextMenu textMenu, bool inGame)
 {
     textMenu.Add(new TextMenu.Button(Dialog.Clean(DialogIds.Connect)).Pressed(() =>
     {
         if (webSocketThread == null && Enabled)
         {
             webSocketThread = new Thread(StartWebSocket);
             webSocketThread.Start();
         }
     }));
 }
Пример #7
0
        public static TextMenu CreateMenu(bool inGame, EventInstance snapshot)
        {
            TextMenu menu = new TextMenu();

            menu.Add(new TextMenu.Header(Dialog.Clean("modoptions_title")));
            menu.Add(new TextMenu.SubHeader($"v.{Everest.VersionString}"));

            Everest.InvokeTyped(
                "CreateModMenuSection",
                new Type[] { typeof(TextMenu), typeof(bool), typeof(EventInstance) },
                menu, inGame, snapshot
                );

            if (menu.Height > menu.ScrollableMinSize)
            {
                menu.Position.Y = menu.ScrollTargetY;
            }

            return(menu);
        }
Пример #8
0
 // ReSharper disable once UnusedMember.Global
 public void CreateCheckDeathStatisticsEntry(TextMenu textMenu, bool inGame)
 {
     textMenu.Add(new TextMenu.Button(Dialog.Clean(DialogIds.CheckDeathStatistics)).Pressed(() => {
         textMenu.Focused = false;
         DeathStatisticsUi buttonConfigUi = new DeathStatisticsUi {
             OnClose = () => textMenu.Focused = true
         };
         Engine.Scene.Add(buttonConfigUi);
         Engine.Scene.OnEndOfFrame += (Action)(() => Engine.Scene.Entities.UpdateLists());
     }));
 }
Пример #9
0
        public override void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot)
        {
            base.CreateModMenuSection(menu, inGame, snapshot);

            menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_coremodule_recrawl")).Pressed(() => {
                Everest.Content.Recrawl();
                Everest.Content.Reprocess();
                VirtualContentExt.ForceReload();
                AreaData.Load();
            }));
        }
Пример #10
0
        protected virtual void CreateModMenuSectionKeyBindings(TextMenu menu, bool inGame, EventInstance snapshot)
        {
            menu.Add(new TextMenu.Button(Dialog.Clean("options_keyconfig")).Pressed(() => {
                menu.Focused = false;
                Engine.Scene.Add(new ModuleSettingsKeyboardConfigUI(this)
                {
                    OnClose = () => menu.Focused = true
                });
                Engine.Scene.OnEndOfFrame += () => Engine.Scene.Entities.UpdateLists();
            }));

            menu.Add(new TextMenu.Button(Dialog.Clean("options_btnconfig")).Pressed(() => {
                menu.Focused = false;
                Engine.Scene.Add(new ModuleSettingsButtonConfigUI(this)
                {
                    OnClose = () => menu.Focused = true
                });
                Engine.Scene.OnEndOfFrame += () => Engine.Scene.Entities.UpdateLists();
            }));
        }
Пример #11
0
        public override IEnumerator Enter(Oui from)
        {
            menu = new TextMenu();

            // display the title and a dummy "Fetching" button
            menu.Add(new TextMenu.Header(Dialog.Clean("MODUPDATECHECKER_MENU_TITLE")));

            menu.Add(subHeader      = new TextMenuExt.SubHeaderExt(Dialog.Clean("MODUPDATECHECKER_MENU_HEADER")));
            willRestartMessageShown = false;

            fetchingButton          = new TextMenu.Button(Dialog.Clean("MODUPDATECHECKER_FETCHING"));
            fetchingButton.Disabled = true;
            menu.Add(fetchingButton);

            Scene.Add(menu);

            menu.Visible = Visible = true;
            menu.Focused = false;

            for (float p = 0f; p < 1f; p += Engine.DeltaTime * 4f)
            {
                menu.X = offScreenX + -1920f * Ease.CubeOut(p);
                alpha  = Ease.CubeOut(p);
                yield return(null);
            }

            menu.Focused = true;

            task = new Task(() => {
                // 1. Download the mod updates database
                updateCatalog = ModUpdaterHelper.DownloadModUpdateList();

                // 2. Find out what actually has been updated
                if (updateCatalog != null)
                {
                    availableUpdatesCatalog = ModUpdaterHelper.ListAvailableUpdates(updateCatalog);
                }
            });

            task.Start();
        }
        private void AddRecord(Ruleset rules, RecordTuple record)
        {
            string formatted = (rules == Ruleset.G || rules == Ruleset.H) ? record.Item1.ToString() : Dialog.Time(record.Item1);

            menu.Add(new TextMenu.Button(Dialog.Clean("MODOPTIONS_RANDOMIZER_RULES_" + rules) + ": " + formatted + " (" + record.Item2 + ")").Pressed(() => {
                Settings.Rules    = rules;
                Settings.SeedType = SeedType.Custom;
                Settings.Seed     = record.Item2;
                Settings.Enforce();
                Overworld.Goto <OuiRandoSettings>();
            }));
        }
Пример #13
0
        private void AddRecord(TextMenu menu, string rules, RecordTuple record, bool isEndless)
        {
            string formatted = isEndless ? record.Item1.ToString() : Dialog.Time(record.Item1);

            menu.Add(new TextMenu.Button(rules + ": " + formatted + " (" + record.Item2 + ")").Pressed(() => {
                Settings.Rules    = rules;
                Settings.SeedType = SeedType.Custom;
                Settings.Seed     = record.Item2;
                Settings.Enforce();
                Overworld.Goto <OuiRandoSettings>();
            }));
        }
Пример #14
0
        // ReSharper disable once UnusedMember.Global
        public void CreateEnabledEntry(TextMenu textMenu, bool inGame)
        {
            firstTextMenu = new TextMenu.OnOff(DialogIds.Enabled.DialogClean(), Enabled);
            firstTextMenu.Change(enabled => {
                Enabled = enabled;
                if (enabled)
                {
                    bool isBeforeMoreOptionsItem = false;
                    foreach (TextMenu.Item item in textMenu.Items)
                    {
                        if (isBeforeMoreOptionsItem)
                        {
                            item.Visible = true;
                        }

                        if (firstTextMenu == item)
                        {
                            isBeforeMoreOptionsItem = true;
                        }

                        if (moreOptionsTextMenu == item)
                        {
                            isBeforeMoreOptionsItem = false;
                        }
                    }
                }
                else
                {
                    bool isSpeedrunToolItem = false;
                    foreach (TextMenu.Item item in textMenu.Items)
                    {
                        if (isSpeedrunToolItem)
                        {
                            item.Visible = false;
                        }

                        if (firstTextMenu == item)
                        {
                            isSpeedrunToolItem = true;
                        }

                        if (lastTextMenu == item)
                        {
                            isSpeedrunToolItem = false;
                        }
                    }
                }

                moreOptionsTextMenu.Visible = enabled;
            });
            textMenu.Add(firstTextMenu);
        }
Пример #15
0
        public void CreateMenu(TextMenu menu, bool inGame)
        {
            currentPreset      = 0;
            enabledText        = new TextMenu.OnOff(Dialog.Clean("MODOPTIONS_HYPERLINE_ENABLED"), Settings.Enabled).Change(EnabledToggled);
            allowMapHairText   = new TextMenu.OnOff(Dialog.Clean("MODOPTIONS_HYPERLINE_ALLOWMAPHAIR"), Settings.AllowMapHairColors).Change(v => Settings.AllowMapHairColors = v);
            maddyCrownText     = new TextMenu.OnOff("Maddy Crown Support:", Settings.DoMaddyCrown).Change(v => { Settings.DoMaddyCrown = v; });
            doFeatherColorText = new TextMenu.OnOff("Do Feather Color", Settings.DoFeatherColor).Change(v => { Settings.DoFeatherColor = v; });
            doDashFlashText    = new TextMenu.OnOff("Do Dash Flash", Settings.DoDashFlash).Change(v => { Settings.DoDashFlash = v; });
            menu.Add(enabledText);
            menu.Add(allowMapHairText);
            menu.Add(maddyCrownText);
            menu.Add(doFeatherColorText);
            menu.Add(doDashFlashText);
            CreatePresetMenu(menu);

            colorMenus    = new List <List <List <TextMenu.Item> > >(); //dashes
            dashCountMenu = new TextMenuExt.OptionSubMenu("Dashes");
            dashCountMenu.SetInitialSelection(lastDash);

            dashCountMenu.Change(v => { UpdateHairType(v, Settings.hairTypeList[v]); });
            for (int counterd = 0; counterd < Hyperline.MAX_DASH_COUNT; counterd++)
            {
                int r = counterd;
                List <TextMenu.Item> Menu = new List <TextMenu.Item>();
                TextMenuExt.EnumerableSlider <uint> HairTypeMenu;
                colorMenus.Add(CreateDashCountMenu(menu, inGame, counterd, out HairTypeMenu));
                if (!inGame)
                {
                    Menu.Add(new TextMenu.Button("Custom Texture: " + Settings.hairTextureSource[counterd]).Pressed(() =>
                    {
                        Audio.Play(SFX.ui_main_savefile_rename_start);
                        menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(Settings.hairTextureSource[r], v => { Settings.hairTextureSource[r] = v; Settings.LoadCustomTexture(r); }, 12);
                    }));
                    Menu.Add(new TextMenu.Button("Custom Bangs: " + Settings.hairBangsSource[counterd]).Pressed(() =>
                    {
                        Audio.Play(SFX.ui_main_savefile_rename_start);
                        menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(Settings.hairBangsSource[r], v => { Settings.hairBangsSource[r] = v; Settings.LoadCustomBangs(r); }, 12);
                    }));
                }

                Menu.Add(new TextMenu.Slider("Speed:", StringFromInt, HyperlineSettings.MIN_HAIR_SPEED, HyperlineSettings.MAX_HAIR_SPEED, Settings.hairSpeedList[counterd]).Change(v => { SetHairSpeed(r, v); }));
                Menu.Add(new TextMenu.Slider("Length:", StringFromInt, HyperlineSettings.MIN_HAIR_LENGTH, Settings.HairLengthSoftCap, Settings.hairLengthList[counterd]).Change(v => { SetHairLength(r, v); }));
                Menu.Add(HairTypeMenu);
                if (!inGame)
                {
                    for (int i = 0; i < colorMenus[counterd].Count; i++)
                    {
                        for (int j = 0; j < colorMenus[counterd][i].Count; j++)
                        {
                            Menu.Add(colorMenus[counterd][i][j]);
                        }
                    }
                }
                dashCountMenu.Add(counterd.ToString(), Menu);
            }
            menu.Add(dashCountMenu);
            UpdateHairType(lastDash, Settings.hairTypeList[lastDash]);
            EnabledToggled(Settings.Enabled);
        }
Пример #16
0
 // ReSharper disable once UnusedMember.Global
 public void CreateEndPointStyleEntry(TextMenu textMenu, bool inGame)
 {
     textMenu.Add(
         new TextMenu.Slider(Dialog.Clean(DialogIds.EndPointStyle),
                             index => Dialog.Clean(DialogIds.Prefix + EndPointStyleStrings[index]),
                             0,
                             EndPointStyleStrings.Count - 1,
                             Math.Max(0, EndPointStyleStrings.IndexOf(EndPointStyle))
                             ).Change(index => {
         EndPointStyle = EndPointStyleStrings[index];
         EndPoint.All.ForEach(endPoint => endPoint.ResetSprite());
     }));
 }
        protected override void CreateModMenuSectionHeader(TextMenu menu, bool inGame, FMOD.Studio.EventInstance snapshot)
        {
            base.CreateModMenuSectionHeader(menu, inGame, snapshot);

            if (failedLoadingDeps)
            {
                menu.Add(new TextMenuExt.SubHeaderExt(Dialog.Clean("communalhelper_failedloadingdeps"))
                {
                    TextColor   = Color.OrangeRed,
                    HeightExtra = 0f,
                });
            }
        }
        protected override void addOptionsToMenu(TextMenu menu, bool inGame)
        {
            menu.Add(new TextMenu.OnOff(DialogIds.TranslucentEnabled.DialogClean(), Settings.TranslucentEnabled).Change(
                         value => Settings.TranslucentEnabled = value));

            TextMenu.Slider item = new TextMenu.Slider(DialogIds.TransparentRadius.DialogClean(),
                                                       value => value.ToString(), 1, 999,
                                                       Settings.TransparentRadius)
            {
                OnValueChange = value => Settings.TransparentRadius = value
            };
            menu.Add(item);
            item.AddDescription(menu, DialogIds.TransparentRadiusDescription.DialogClean());

            item = new TextMenu.Slider(DialogIds.TranslucentRadius.DialogClean(), value => value.ToString(), 1, 999,
                                       Settings.TranslucentRadius)
            {
                OnValueChange = value => Settings.TranslucentRadius = value
            };
            menu.Add(item);
            item.AddDescription(menu, DialogIds.TranslucentRadiusDescription.DialogClean());
        }
Пример #19
0
        public void CreateLaunchWithFMODLiveUpdateEntry(TextMenu menu, bool inGame)
        {
            if (inGame || typeof(Settings).GetField("LaunchWithFMODLiveUpdate") == null)
            {
                return;
            }

            menu.Add(
                new TextMenu.OnOff(Dialog.Clean("modoptions_coremodule_launchwithfmodliveupdate"), LaunchWithFMODLiveUpdate)
                .Change(v => LaunchWithFMODLiveUpdate = v)
                .NeedsRelaunch()
                );
        }
Пример #20
0
 // ReSharper disable once UnusedMember.Global
 public void CreateButtonConfigEntry(TextMenu textMenu, bool inGame)
 {
     textMenu.Add(lastTextMenu = new TextMenu.Button(Dialog.Clean(DialogIds.ButtonConfig)).Pressed(() => {
         textMenu.Focused = false;
         ButtonConfigUi buttonConfigUi = new ButtonConfigUi {
             OnClose = () => textMenu.Focused = true
         };
         Engine.Scene.Add(buttonConfigUi);
         Engine.Scene.OnEndOfFrame += (Action)(() => Engine.Scene.Entities.UpdateLists());
     }));
     firstTextMenu.OnValueChange(Enabled);
     ToggleMoreOptionsMenuItem(textMenu, false);
 }
Пример #21
0
        /*
         * [SettingRange(0, 10)]
         * public int ExampleSlider { get; set; } = 5;
         *
         * [SettingRange(0, 10)]
         * [SettingInGame(false)]
         * public int ExampleMainMenuSlider { get; set; } = 5;
         *
         * [SettingRange(0, 10)]
         * [SettingInGame(true)]
         * public int ExampleInGameSlider { get; set; } = 5;
         */

        public void CreateLaunchInDebugModeEntry(TextMenu menu, bool inGame)
        {
            if (inGame || typeof(Settings).GetField("LaunchInDebugMode") == null)
            {
                return;
            }

            menu.Add(
                new TextMenu.OnOff(Dialog.Clean("modoptions_coremodule_launchindebugmode"), LaunchInDebugMode)
                .Change(v => LaunchInDebugMode = v)
                .NeedsRelaunch()
                );
        }
Пример #22
0
 // ReSharper disable once UnusedMember.Global
 public void CreateMaxNumberOfDeathDataEntry(TextMenu textMenu, bool inGame)
 {
     textMenu.Add(new TextMenu.Slider(
                      DialogIds.MaxNumberOfDeathData.DialogClean(),
                      value => value == 0 ? "90" : (value * 10).ToString(),
                      1,
                      9,
                      MaxNumberOfDeathData
                      )
     {
         OnValueChange = value => MaxNumberOfDeathData = value
     });
 }
Пример #23
0
 // ReSharper disable once UnusedMember.Global
 public void CreateEndPointStyleEntry(TextMenu textMenu, bool inGame)
 {
     textMenu.Add(
         new TextMenu.Slider(Dialog.Clean(DialogIds.EndPointStyle),
                             index => Dialog.Clean(DialogIds.Prefix + EndPointStyleStrings[index]),
                             0,
                             EndPointStyleStrings.Count - 1,
                             Math.Max(0, EndPointStyleStrings.IndexOf(EndPointStyle))
                             ).Change(index => {
         EndPointStyle = EndPointStyleStrings[index];
         RoomTimerManager.Instance.SavedEndPoint?.ResetSprite();
     }));
 }
 public void CreateChannelNameEntry(TextMenu textMenu, bool inGame)
 {
     if (!inGame)
     {
         textMenu.Add(new TextMenu.Button(Dialog.Clean(DialogIds.ChannelName) + ": " + ChannelName).Pressed(() =>
         {
             textMenu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
                 ChannelName,
                 v => ChannelName = v,
                 maxValueLength: 30
                 );
         }));
     }
 }
        public void Start()
        {
            if (!string.IsNullOrEmpty(pageTitle))
            {
                pageTitle = pageTitle.UnMangleConfigText();
            }

            topMenu           = new TextMenu();
            topMenu.menuTitle = "== Science ==";

            experimentsMenu                  = new TextMenu();
            experimentsMenu.menuTitle        = "== Experiments ==";
            experimentsMenu.rightColumnWidth = 6;
            experimentsMenu.rightTextColor   = "[#00ff00]";

            containersMenu           = new TextMenu();
            containersMenu.menuTitle = "== Containers ==";

            topMenu.Add(new TextMenu.Item("Run all science", RunAllScience));
            topMenu.Add(new TextMenu.Item("Experiments", (id, item) => OpenSubMenu(experimentsMenu)));
            topMenu.Add(new TextMenu.Item("Containers", (id, item) => OpenSubMenu(containersMenu)));

            OpenSubMenu(topMenu);
        }
        private void OpenContainerDetails(int containerIndex, TextMenu.Item containerItem)
        {
            var containerModule = containerModules[containerIndex];
            var detailsMenu     = new TextMenu();

            detailsMenu.menuTitle = containerModule.GUIName;

            for (int actionIndex = 0; actionIndex < containerModule.Actions.Count; ++actionIndex)
            {
                var action = containerModule.Actions[actionIndex];
                detailsMenu.Add(new TextMenu.Item(action.guiName, (id, item) => action.Invoke(activateParam)));
            }

            OpenSubMenu(detailsMenu);
        }
Пример #27
0
 public void CreateServerEntry(TextMenu menu, bool inGame)
 {
     menu.Add(
         (ServerEntry = new TextMenu.Button(("modoptions_ghostnetmodule_server".DialogCleanOrNull() ?? "Server") + ": " + Server))
         .Pressed(() => {
         Audio.Play("event:/ui/main/savefile_rename_start");
         menu.SceneAs <Overworld>().Goto <OuiModOptionString>().Init <OuiModOptions>(
             Server,
             v => Server = v,
             maxValueLength: 30
             );
     })
         );
     ServerEntry.Disabled = inGame || Connection;
 }
Пример #28
0
        public static void CreateMenu(EverestModule everestModule, TextMenu menu, bool inGame)
        {
            menu.Add(new TextMenu.OnOff("Enabled".ToDialogText(), Settings.Enabled).Change((value) => {
                Settings.Enabled = value;
                foreach (TextMenu.Item item in options)
                {
                    item.Visible = value;
                }
            }));
            CreateOptions(everestModule, menu, inGame);
            foreach (TextMenu.Item item in options)
            {
                menu.Add(item);
                item.Visible = Settings.Enabled;
            }

            if (inGame)
            {
                showHitboxesSubmenu.AddDescription(menu, "Hitbox Color Description 2".ToDialogText());
                showHitboxesSubmenu.AddDescription(menu, "Hitbox Color Description 1".ToDialogText());
            }

            keyConfigButton.AddDescription(menu, "Key Config Description".ToDialogText());
        }
Пример #29
0
        public override void CreateModMenuSection(TextMenu menu, bool inGame, EventInstance snapshot)
        {
            base.CreateModMenuSection(menu, inGame, snapshot);

            if (inGame)
            {
                menu.Add(new TextMenu.Button(Dialog.Clean("modoptions_rainbowmodule_reloadcolors")).Pressed(() => {
                    // Temporarily store current settings, load new settings and replace colors.
                    RainbowModuleSettings settings = Settings;
                    LoadSettings();
                    settings.FoxColorLight = Settings.FoxColorLight;
                    settings.FoxColorDark  = Settings.FoxColorDark;
                    _Settings = settings;
                }));
            }
        }
 public void CreateEnabledEntry(TextMenu textMenu, bool inGame)
 {
     TextMenu.Item item = new TextMenu.OnOff(DialogId.Options.Enabled.DialogClean(), Enabled)
                          .Change(value => {
         Enabled = value;
         if (Enabled)
         {
             InfiniteBackupsModule.Instance.Load();
         }
         else
         {
             InfiniteBackupsModule.Instance.Unload();
         }
         RefreshItemsStates();
     });
     textMenu.Add(item);
     menuItems.Add(DialogId.Options.Enabled, item);
 }
Пример #31
0
	void Page_Load(object sender, System.EventArgs e)
	{
		// declare the menu and set its properties
		TextMenu tm = new TextMenu();
		tm.ID = "TextMenu1";
		
		// add the menu to page
		Page.Controls.Add(tm);

		string sConnectionString;
		OleDbDataReader oReader;
		
		// set the connection string
		sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("../App_Data/DBDEMO.mdb");
		OleDbConnection Cn = new OleDbConnection(sConnectionString);
		
		// The database has one table called items containing both parent items and menu items
		// LEVEL shows what level the item is at (0 - parent item, 1 - belongs to menu attached to parent item, etc)
		// ORDER sets what is the item's order in the current menu (1 - first item, 2 - second item, etc.)
		// it is very important to add parent elements first, then level 1 items, then level 2 items, etc.
		string SQL = "SELECT * FROM Items ORDER BY [LEVEL], [ORDER]";
		OleDbCommand Com = new OleDbCommand(SQL,Cn);
		Cn.Open();
		oReader = Com.ExecuteReader();

		// Populate TM.
		while (oReader.Read()) 
		{
			// if PARENTID is null, we're adding a parent element, otherwise it's a menu item
			tm.Add(oReader.IsDBNull(oReader.GetOrdinal("PARENTID")) ? null : oReader.GetString(oReader.GetOrdinal("PARENTID")), 
					oReader.GetString(oReader.GetOrdinal("ID")),
					oReader.IsDBNull(oReader.GetOrdinal("HTML")) ? "" : oReader.GetString(oReader.GetOrdinal("HTML")),
					oReader.IsDBNull(oReader.GetOrdinal("URL")) ? null : oReader.GetString(oReader.GetOrdinal("URL")),
					oReader.IsDBNull(oReader.GetOrdinal("URLTARGET")) ? null : oReader.GetString(oReader.GetOrdinal("URLTARGET")));
		}

		oReader.Close();
		Cn.Close();
	}
Пример #32
0
	private void Page_Load(object sender, System.EventArgs e)
	{
		System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
		xmlDoc.Load(Server.MapPath("TextMenuXML.xml"));

		System.Xml.XmlNodeList menuNodes = xmlDoc.SelectNodes("/TextMenu");

		foreach (System.Xml.XmlNode menuNode in menuNodes)
		{
			string menuID = menuNode.Attributes["ID"].Value;

			// create new TextMenu object ...
			TextMenu tmpMenu = new TextMenu();
			tmpMenu.ID = menuID;
			
			// take the childs and create the menu items ...
			System.Xml.XmlNodeList menuItemsNodes = menuNode.SelectNodes("//Item");

			foreach (System.Xml.XmlNode menuItemNode in menuItemsNodes)
			{
				string menuItemID = menuItemNode.Attributes["ID"].Value;
				string InnerHTML = menuItemNode.Attributes["InnerHTML"].Value;
				string parentMenuItemID = null;
				if (menuItemNode.Attributes["ParentID"] != null)
					parentMenuItemID = menuItemNode.Attributes["ParentID"].Value;
				string menuUrl = null;
				if (menuItemNode.Attributes["Url"] != null)
					menuUrl = menuItemNode.Attributes["Url"].Value;

				// create new Menu item object and add it to the created menu ...
				tmpMenu.Add(parentMenuItemID, menuItemID, InnerHTML, menuUrl, null);
			}
			
			placeHolder1.Controls.Add(tmpMenu);
		}
	}
        private void ShowCrewEVA(int index, TextMenu.Item ti)
        {
            currentMenu = MenuList.CrewEVA;

            activeMenu = new TextMenu();
            activeMenu.labelColor = nameColorTag;
            activeMenu.selectedColor = selectedColorTag;
            activeMenu.disabledColor = unavailableColorTag;
            activeMenu.rightTextColor = distanceColorTag;

            var vesselCrew = vessel.GetVesselCrew();
            for (int crewIdx = 0; crewIdx < vesselCrew.Count; ++crewIdx)
            {
                if (vesselCrew[crewIdx] != null)
                {
                    var tmi = new TextMenu.Item();
                    tmi.action = CrewEVA;
                    tmi.labelText = vesselCrew[crewIdx].name;
                    tmi.rightText = vesselCrew[crewIdx].experienceTrait.Title;
                    tmi.isSelected = false;
                    tmi.id = crewIdx;
                    activeMenu.Add(tmi);
                }
            }
        }
        // MOARdV: Spaceplane Guidance can not be implemented cleanly, because
        // MJ's MechJebModuleSpaceplaneGuidance is missing the 'public'
        // keyword.  We could use another controller (like ourself), but that
        // means one is forced to use our menu to turn it off (the MJ GUI is
        // not able to change the setting), and vice versa.  Since every other
        // place where we interface with MJ, we use MJ's objects as the
        // controller, this breaks our design model.  If/when MJ makes the
        // module public, all of the commented code here related to it can be
        // uncommented, and this missive can be deleted.
        //private void SpaceplaneGuidance(int index, TextMenu.Item tmi)
        //{
        //    UpdateJebReferences();
        //    if (activeJeb != null) {
        //        var autopilot = activeJeb.GetComputerModule<MechJebModuleSpaceplaneAutopilot>();
        //        if (autopilot != null) {
        //            MechJebModuleSpaceplaneGuidance is not currently public.  Can't use it.
        //            var autopilotController = activeJeb.GetComputerModule<MechJebModuleSpaceplaneGuidance>();
        //            if (autopilotController != null) {
        //                if (autopilot.enabled && autopilot.mode == MechJebModuleSpaceplaneAutopilot.Mode.HOLD) {
        //                    autopilot.AutopilotOff();
        //                } else if (!autopilot.enabled) {
        //                    autopilot.HoldHeadingAndAltitude(autopilotController);
        //                }
        //            }
        //        }
        //    }
        //}
        private void CircularizeMenu(int index, TextMenu.Item tmi)
        {
            currentMenu = MJMenu.CircularizeMenu;

            activeMenu = new TextMenu();
            activeMenu.labelColor = JUtil.ColorToColorTag(itemColorValue);
            activeMenu.selectedColor = JUtil.ColorToColorTag(selectedColorValue);
            activeMenu.disabledColor = JUtil.ColorToColorTag(unavailableColorValue);
            activeMenu.menuTitle = "== Circularize Menu:";

            activeMenu.Add(new TextMenu.Item("At Next Ap", DoCircularize, (int)JSIMechJeb.TimeReference.APOAPSIS));
            activeMenu.Add(new TextMenu.Item("At Next Pe", DoCircularize, (int)JSIMechJeb.TimeReference.PERIAPSIS));
            activeMenu.Add(new TextMenu.Item("In 15s", DoCircularize, (int)JSIMechJeb.TimeReference.X_FROM_NOW));
        }
Пример #35
0
        private void ShowFiltersMenu(int index, TextMenu.Item ti)
        {
            currentMenu = MenuList.Filters;

            activeMenu = new TextMenu();

            activeMenu.labelColor = nameColorTag;
            activeMenu.selectedColor = selectedColorTag;
            activeMenu.disabledColor = unavailableColorTag;
            activeMenu.rightTextColor = distanceColorTag;
            for (int i = 0; i < vesselFilter.Count; i++)
            {
                var filter = vesselFilter.ElementAt(i);
                var tmi = new TextMenu.Item();
                tmi.labelText = filter.Key.ToString().PadRight(9) + (filter.Value ? "- On" : "- Off");
                tmi.isSelected = filter.Value;
                tmi.action = ToggleFilter;
                activeMenu.Add(tmi);
            }
        }
	private void Page_Load(object sender, System.EventArgs e)
	{
		TextMenu tm1 = new TextMenu();
		tm1.ID = "tm1";
		tm1.StyleFolder = "styles/submenuicon";
		tm1.SubMenuText = "";

		tm1.Add(null, "brands", "Brands", null, null);
			tm1.Add("brands", "ibm", "IBM");
			tm1.Add("brands", "microsoft", "MICROSOFT");
			tm1.Add("brands", "obout", "OBOUT", "http://www.obout.com/", "_top");
				tm1.Add("obout", "treeview", "TreeView", "http://www.obout.com/t2/edraganddrop.aspx", "_top");
				tm1.Add("obout", "slidemenu", "Slide Menu", "http://www.obout.com/sm3/whatisnew.aspx", "_top");
				tm1.Add("obout", "calendar", "Calendar", "http://www.obout.com/calendar/", "_top");
				tm1.Add("obout", "postback", "AJAXPage", "http://www.obout.com/AJAXPage/", "_top");
				tm1.Add("obout", "splitter", "Splitter", "http://www.obout.com/splitter/", "_top");
				tm1.Add("obout", "easymenu", "EasyMenu", "http://www.obout.com/em/", "_top");
				tm1.Add("obout", "combobox", "Combobox", "http://www.obout.com/combobox/", "_top");
				tm1.Add("obout", "editor", "HTML Editor", "http://www.obout.com/editor_new/", "_top");
				tm1.Add("obout", "treedb", "Tree_DB", "http://www.obout.com/t_db/index.aspx", "_top");
				tm1.Add("obout", "textmenu", "TextMenu", "http://www.obout.com/tm/tm.aspx", "_top");
		tm1.Add(null, "systems", "Systems");
			tm1.Add("systems", "desktops", "Desktops");
			tm1.Add("systems", "handhelds", "Handhelds");
			tm1.Add("systems", "notebooks", "Notebooks");
			tm1.Add("systems", "servers", "Servers");
		tm1.Add(null, "hardware", "Hardware");
			tm1.Add("hardware", "accessories", "Accessories");
			tm1.Add("hardware", "keyboards", "Keyboards");
			tm1.Add("hardware", "memory", "Memory");
			tm1.Add("hardware", "printers", "Printers");
			tm1.Add("hardware", "videocards", "Video Cards");
		tm1.Add(null, "software", "Software");
			tm1.Add("software", "applications", "Applications");
			tm1.Add("software", "licensing", "Licensing");

		this.Controls.Add(tm1);
	}
        private void TargetMenu(int index, TextMenu.Item tmi)
        {
            currentMenu = MJMenu.TargetMenu;

            activeMenu = new TextMenu();
            activeMenu.labelColor = JUtil.ColorToColorTag(itemColorValue);
            activeMenu.selectedColor = JUtil.ColorToColorTag(selectedColorValue);
            activeMenu.disabledColor = JUtil.ColorToColorTag(unavailableColorValue);

            foreach (JSIMechJeb.Target target in targetTargets)
            {
                activeMenu.Add(new TextMenu.Item(JSIMechJeb.TargetTexts[(int)target].Replace('\n', ' '), SelectTarget));
            }
        }