// TODO: Look at Menu (Stacking???) /// <summary> /// Called when [load]. /// </summary> protected sealed override void OnLoad() { this.Menu = new Menu(this.Name, this.Name); this.Menu.AddItem(new MenuItem(this.Name + "Enabled", "Enabled").SetValue(true)); this.BlacklistMenu = new BlacklistMenu(this.Menu, "Blacklist"); #region Stacking (Dynamic-Menu) var advancedDyn = new Menu("Advanced", this.Name + "Advanced"); this.Menu.AddSubMenu(advancedDyn); advancedDyn.AddItem( new MenuItem(advancedDyn.Name + "EvaluationMode", "Evaluation Mode").SetValue( new StringList(new[] { "Priority", "Count", "Damage", "Custom" }, 0))).ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs) { MenuExtensions.RefreshTagBased( advancedDyn, eventArgs.GetNewValue <StringList>().SelectedIndex + 1); }; // Priority advancedDyn.AddItem( new MenuItem(advancedDyn.Name + "MinPriority", "Only if Priority sum >=").SetValue(new Slider(8, 1, 25)) .SetTag(1)); // Count advancedDyn.AddItem( new MenuItem(advancedDyn.Name + "Disclaimer", "[i] Can't recommend using this").SetTag(2)); // Damage advancedDyn.AddItem( new MenuItem(advancedDyn.Name + "Information", "[i] information").SetTooltip( "If this is enabled, the assembly will stack based on the current gapclose PathBase. Currently here are no options, but if I got enough time and motivation I will add some.") .SetTag(3)); // Always available advancedDyn.AddItem(new MenuItem(advancedDyn.Name + "", " ")); advancedDyn.AddItem( new MenuItem(advancedDyn.Name + "MinPlayerHealth", "Min Player Health").SetValue(new Slider(0))); advancedDyn.AddItem(new MenuItem(advancedDyn.Name + "MinHealthDifference", "Min Health Difference")); MenuExtensions.RefreshTagBased( advancedDyn, advancedDyn.Item(advancedDyn.Name + "EvaluationMode").GetValue <StringList>().SelectedIndex + 1); #endregion this.Menu.AddItem( new MenuItem(this.Name + "MinHitAOE", "Min HitCount EQ Flash").SetValue(new Slider(3, 1, 5))); this.Parent.Menu.AddSubMenu(this.Menu); }
/// <summary> /// Setups the menu. /// </summary> /// <param name="menu">The menu</param> public void Generate(Menu menu) { this.Menu = menu; if ((this.Menu == null) || (this.menuSets == null) || !this.menuSets.Any()) { return; } this.attachedMenu = new Menu(this.displayName, this.Menu.Name + this.displayName); this.Menu.AddSubMenu(this.attachedMenu); #if DEBUG Console.WriteLine(string.Empty); Console.WriteLine(@"==== Setting up new DynamicMenu ===="); Console.WriteLine(@"DisplayName: " + this.displayName); Console.WriteLine(@"Internal Menu Name: " + this.Menu.Name + this.displayName); Console.WriteLine(@"MenuSets Amount: " + this.menuSets.Count); Console.WriteLine(@"Internal Selecter Name: " + this.selecter.Name); Console.WriteLine(@"Displaying Selecter Name: " + this.selecter.DisplayName); Console.WriteLine(@"Example Naming: " + this.displayName + @"SomeItemName"); #endif var value = this.selecter.GetValue <StringList>(); this.attachedMenu.AddItem( new MenuItem(this.attachedMenu.Name + this.selecter.Name, this.selecter.DisplayName).SetValue(value)) .ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs) { foreach (var item in this.attachedMenu.Items) { if (item.Tag != 0) { item.Hide(); } if (item.Tag == eventArgs.GetNewValue <StringList>().SelectedIndex + 1) { item.Show(); } } }; var tag = 1; foreach (var itemSet in this.menuSets) { foreach (var item in itemSet) { item.Name = this.attachedMenu.Name + item.Name; this.attachedMenu.AddItem(item).SetTag(tag); } tag++; } #if DEBUG { foreach (var item in this.attachedMenu.Items) { Console.WriteLine(@"DisplayName: {0}, Internal Name: {1}", item.DisplayName, item.Name); } } #endif MenuExtensions.RefreshTagBased( this.attachedMenu, this.attachedMenu.Item(this.attachedMenu.Name + this.selecter.Name).GetValue <StringList>().SelectedIndex + 1); }
/// <summary> /// Setups the menu. /// </summary> internal void Initialize() { if (this.Menu == null || this.MenuSets == null || !this.MenuSets.Any()) { return; } this.AttachedMenu = new Menu(this.DisplayName, this.Menu.Name + this.DisplayName); this.Menu.AddSubMenu(this.AttachedMenu); if (GlobalVariables.Debug) { Console.WriteLine(@" "); Console.WriteLine(@"==== Setting up new DynamicMenu ===="); Console.WriteLine(@"DisplayName: " + this.DisplayName); Console.WriteLine(@"Internal Menu Name: " + this.Menu.Name + this.DisplayName); Console.WriteLine(@"MenuSets Amount: " + this.MenuSets.Count); Console.WriteLine(@"Internal Selecter Name: " + this.Selecter.Name); Console.WriteLine(@"Displaying Selecter Name: " + this.Selecter.DisplayName); Console.WriteLine(@"Example Naming: " + this.DisplayName + @"SomeItemName"); Console.WriteLine(@" "); } var value = this.Selecter.GetValue <StringList>(); this.AttachedMenu.AddItem( new MenuItem(this.AttachedMenu.Name + this.Selecter.Name, this.Selecter.DisplayName).SetValue(value)) .ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs) { foreach (var item in this.AttachedMenu.Items) { if (item.Tag != 0) { item.Hide(); } if (item.Tag == eventArgs.GetNewValue <StringList>().SelectedIndex + 1) { item.Show(); } } }; var tag = 1; foreach (var itemSet in this.MenuSets) { foreach (var item in itemSet) { item.Name = this.AttachedMenu.Name + item.Name; this.AttachedMenu.AddItem(item).SetTag(tag); } tag++; } if (GlobalVariables.Debug) { foreach (var item in this.AttachedMenu.Items) { Console.WriteLine(@"DisplayName: {0}, Internal Name: {1}", item.DisplayName, item.Name); } } MenuExtensions.RefreshTagBased( this.AttachedMenu, this.AttachedMenu.Item(this.AttachedMenu.Name + this.Selecter.Name).GetValue <StringList>().SelectedIndex + 1); }