Ejemplo n.º 1
0
 public static void AddItems(this Menu menu, List<MenuItem> menuItems)
 {
     foreach (var menuItem in menuItems)
     {
         menu.AddItem(menuItem);
     }
 }
 public static MenuItem AddHitChance(this Menu menu, string name, string displayName, HitChance defaultHitChance)
 {
     return
         menu.AddItem(
             new MenuItem(name, displayName).SetValue(
                 new StringList(new[] { "Low", "Medium", "High", "Very High" }, (int) defaultHitChance - 3)));
 }
 public static void AddItem(this SenseListControl control, SenseListControl.ISenseListItem item, bool giveUniqueName)
 {
     if (giveUniqueName)
     {
         item.Name = "UniqueName" + _counter++;
     }
     control.AddItem(item);
 }
Ejemplo n.º 4
0
 public static DsalBinarySearchTree AddItems(this DsalBinarySearchTree bst, IEnumerable<int> itemsToAdd)
 {
     foreach (var item in itemsToAdd)
     {
         bst.AddItem(item);
     }
     return bst;
 }
 public static MenuItem AddList(this Menu menu,
     string name,
     string displayName,
     string[] list,
     int selectedIndex = 0)
 {
     return menu.AddItem(new MenuItem(name, displayName).SetValue(new StringList(list, selectedIndex)));
 }
Ejemplo n.º 6
0
 public static LeagueSharp.Common.MenuItem KeyBind(this LeagueSharp.Common.Menu subMenu,
     string name,
     string display,
     Keys key,
     KeyBindType type = KeyBindType.Press)
 {
     return subMenu.AddItem(new LeagueSharp.Common.MenuItem(name, display).SetValue<KeyBind>(new KeyBind((uint)key, type)));
 }
        public static OrderItem AddItem(this Order order, string product)
        {
            var orderItem = new OrderItem {Product = product};

            order.AddItem(orderItem);

            return orderItem;
        }
Ejemplo n.º 8
0
        public static GenericMenu Add(this GenericMenu menu, string text, Action func, bool selected = false) {
            if (func == null) {
                menu.AddDisabledItem(new GUIContent(text));
            } else {
                menu.AddItem(new GUIContent(text), selected, () => func());
            }

            return menu;
        }
Ejemplo n.º 9
0
 public static void AddSlider(this Menu menu,
     string name,
     string displayName,
     int value,
     int min = 0,
     int max = 100)
 {
     menu.AddItem(new MenuItem(name, displayName).SetValue(new Slider(value, min, max)));
 }
Ejemplo n.º 10
0
 public static void AddCircle(this Menu menu,
     string name,
     string displayName,
     Color color,
     float radius = 0,
     bool enabled = true)
 {
     menu.AddItem(new MenuItem(name, displayName).SetValue(new Circle(enabled, color, radius)));
 }
Ejemplo n.º 11
0
        public static void AddObject(this Menu menu, string name, string displayName, object value = null)
        {
            var i = menu.AddItem(new MenuItem(name, displayName));

            if (value != null)
            {
                i.SetValue(value);
            }
        }
Ejemplo n.º 12
0
 public static void AddKeyBind(this Menu menu,
     string name,
     string displayName,
     uint key,
     KeyBindType type = KeyBindType.Press,
     bool defaultValue = false)
 {
     menu.AddItem(new MenuItem(name, displayName).SetValue(new KeyBind(key, type, defaultValue)));
 }
Ejemplo n.º 13
0
		public static void AddItem(
			this GenericMenu menu,
			string osxText, string osxKey,
			string winText, string winKey,
			bool on,
			GenericMenu.MenuFunction func)
		{
#if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2
			if (Application.platform == RuntimePlatform.OSXEditor)
				menu.AddItem(new GUIContent(osxText + " _" + osxKey), on, func);
			else
				menu.AddItem(new GUIContent(winText + " _" + winKey), on, func);
#else
			if (Application.platform == RuntimePlatform.OSXEditor)
				menu.AddItem(new GUIContent(osxText), on, func);
			else
				menu.AddItem(new GUIContent(winText + DecodeWinKey(winKey)), on, func);
#endif
		}
Ejemplo n.º 14
0
 //TODO make it better?
 public static void AddKillstealMenu(this Menu menu, SpellSlot[] spells, bool[] values)
 {
     for (int i = 0; i < spells.Count(); i++)
     {
         menu.AddItem(
             new MenuItem(
                 "com.idzkatarina.killsteal.use" + GetStringFromSpellSlot(spells[i]).ToLowerInvariant(),
                 "Use " + GetStringFromSpellSlot(spells[i]) + " Killsteal"));
     }
 }
Ejemplo n.º 15
0
 public static void AddModeMenu(this LeagueSharp.Common.Menu menu, Mode mode, SpellSlot[] spellList, bool[] values)
 {
     for (var i = 0; i < spellList.Count(); i++)
     {
         menu.AddItem(
             new MenuItem(
                 BaseName + ObjectManager.Player.ChampionName.ToLowerInvariant() + ".use" + GetStringFromSpellSlot(spellList[i]).ToLowerInvariant() + GetStringFromMode(mode),
                 "Use " + GetStringFromSpellSlot(spellList[i]) + " " + GetFullNameFromMode(mode)).SetValue(values[i]));
     }
 }
Ejemplo n.º 16
0
 public static void AddModeMenu(this Menu menu, Mode mode, SpellSlot[] spellList, bool[] values)
 {
     for (var i = 0; i < spellList.Count(); i++)
     {
         menu.AddItem(
             new MenuItem(
                 "dzaio.champion."+DZAIO.Player.ChampionName.ToLowerInvariant()+".use" + GetStringFromSpellSlot(spellList[i]).ToLowerInvariant() + GetStringFromMode(mode),
                 "Use " + GetStringFromSpellSlot(spellList[i]) + " " + GetFullNameFromMode(mode)).SetValue(values[i]));
     }
 }
Ejemplo n.º 17
0
 public static void AddOptionalItem(this GenericMenu menu, bool isEnabled, GUIContent content, bool isOn, GenericMenu.MenuFunction handler)
 {
     if (isEnabled)
     {
         menu.AddItem(content, isOn, handler);
     }
     else
     {
         menu.AddDisabledItem(content);
     }
 }
Ejemplo n.º 18
0
 public static void AddDrawMenu(this Menu menu, Dictionary<SpellSlot,Spell> dictionary,Color myColor)
 {
     foreach (var entry in dictionary)
     {
         var slot = entry.Key;
         if (entry.Value.Range < 4000f)
         {
             menu.AddItem(new MenuItem("dzaio."+ObjectManager.Player.ChampionName.ToLowerInvariant() + ".drawing.draw" + GetStringFromSpellSlot(slot), "Draw " + GetStringFromSpellSlot(slot)).SetValue(new Circle(true, myColor)));
         }
     }
 }
Ejemplo n.º 19
0
 public static void AddBool(this Menu menu, string path, string message, bool toggle = true)
 {
     try
     {
         menu.AddItem(new MenuItem("apollo.leblanc." + path, message).SetValue(toggle));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
     }
 }
Ejemplo n.º 20
0
 public static void AddDrawMenu(this LeagueSharp.Common.Menu menu, Dictionary<SpellSlot, Spell> dictionary, Color myColor)
 {
     foreach (var entry in dictionary)
     {
         var slot = entry.Key;
         if (entry.Value.Range < 4000f)
         {
             menu.AddItem(new MenuItem(BaseName + ".drawing.draw" + GetStringFromSpellSlot(slot), "Draw " + GetStringFromSpellSlot(slot)).SetValue(new Circle(true, myColor)));
         }
     }
 }
Ejemplo n.º 21
0
 public static void AddDrawMenu(this Menu menu, Dictionary<SpellSlot, Spell> dictionary, System.Drawing.Color myColor)
 {
     foreach (var entry in dictionary)
     {
         var slot = entry.Key;
         if (entry.Value.Range < 5000f)
         {
             menu.AddItem(new MenuItem(ObjectManager.Player.ChampionName + "Draw" + GetStringFromSpellSlot(slot), "Draw " + GetStringFromSpellSlot(slot)).SetValue(new Circle(true, myColor)));
         }
     }
 }
Ejemplo n.º 22
0
 public static void AddKeyBind(this Menu menu, string path, string text, string key, KeyBindType type)
 {
     try
     {
         menu.AddItem(
             new MenuItem("apollo.leblanc." + path, text).SetValue(new KeyBind(key.ToCharArray()[0], type)));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Ejemplo n.º 23
0
        public static void Closure( this ItemSet itemset,cfg cfg, FirstSet first)
        {
            HashSet<Production> productions = cfg.Productions;
            bool changed;
            do
            {
                changed = false;
                char end = System.Configuration.ConfigurationManager.AppSettings["End"][0];
                for (int i = 0; i < itemset.Count; ++i)
                {
                    Item item = itemset.ElementAt(i);
                    int index = item.Index;
                    string right = item.Production.Right;
                    if (index >= right.Length || !cfg.isVn(right[index]))
                    {
                        continue;
                    }
                    foreach (Production production in productions)
                    {
                        if (production.Left != right[index])
                        {
                            continue;
                        }
                        int length = right.Length;
                        if (index + 1 == right.Length)
                        {
                            Item newItem = new Item(production, 0,item.Symbol);
                            changed |= itemset.AddItem(newItem);
                            continue;
                        }

                        if (index + 1 < right.Length)
                        {
                            char empty = System.Configuration.ConfigurationManager.AppSettings["Empty"][0];
                            HashSet<char> symbols = first.GetFirst(right[index + 1]);
                            foreach (char c in symbols)
                            {
                                if (c == empty)
                                {
                                    Item newItem = new Item(production, 0, item.Symbol);
                                    changed |= itemset.Add(newItem);
                                }
                                else
                                {
                                    Item newItem = new Item(production, 0, c);
                                    changed |= itemset.Add(newItem);
                                }
                            }
                        }
                    }
                }
            } while (changed);
        }
Ejemplo n.º 24
0
 public static void AddModeMenu(this Menu menu, Mode mode, SpellSlot[] spellList, bool[] values)
 {
     for (var i = 0; i < spellList.Count(); i++)
     {
         menu.AddItem(
             new MenuItem(
                 "com.idzlucian.use" + GetStringFromSpellSlot(spellList[i]).ToLowerInvariant() +
                 GetStringFromMode(mode),
                 "Use " + GetStringFromSpellSlot(spellList[i]) + " " + GetFullNameFromMode(mode)).SetValue(
                     values[i]));
     }
 }
Ejemplo n.º 25
0
 public static void AddHitChance(this Menu menu, string path, int minimumHitchance = 2)
 {
     try
     {
         menu.AddItem(
             new MenuItem("apollo.leblanc." + path, "Minimum HitChance").SetValue(
                 new StringList((new[] { "Low", "Medium", "High", "Very High" }), minimumHitchance)));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
     }
 }
Ejemplo n.º 26
0
        public static ContextMenu AddTextBoxItems(this ContextMenu menu) {
            if (!menu.Items.IsEmpty) {
                menu.AddSeparator();
            }

            return menu
                .AddItem(ApplicationCommands.Undo)
                .AddSeparator()
                .AddItem(ApplicationCommands.Cut)
                .AddItem(ApplicationCommands.Copy)
                .AddItem(ApplicationCommands.Paste)
                .AddItem(ApplicationCommands.Delete)
                .AddSeparator()
                .AddItem(ApplicationCommands.SelectAll);
        }
Ejemplo n.º 27
0
        public static List<MenuItem> AddChampMenu(this Menu mainMenu, bool defValue)
        {
            var champsList = new List<MenuItem>();
            var baseName = mainMenu.Name.ToLower();

            // ReSharper disable once LoopCanBeConvertedToQuery
            foreach (var champion in GameObjects.EnemyHeroes)
            {
                var champItem = new MenuItem($"{baseName}.{champion.ChampionName.ToLower()}", champion.ChampionName).SetValue(defValue);
                mainMenu.AddItem(champItem);

                champsList.Add(champItem);
            }

            return champsList;
        }
Ejemplo n.º 28
0
        public static EntityType AddTable(this EdmModel database, string name)
        {
            DebugCheck.NotEmpty(name);

            var uniqueIdentifier = database.EntityTypes.UniquifyName(name);

            var table
                = new EntityType(
                    uniqueIdentifier,
                    DefaultStoreNamespace,
                    DataSpace.SSpace);

            database.AddItem(table);
            database.AddEntitySet(table.Name, table, uniqueIdentifier);

            return table;
        }
        /// <summary>
        /// Creates the and add function.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="name">The name.</param>
        /// <param name="parameters">The parameters.</param>
        /// <param name="returnValues">The return values.</param>
        /// <param name="body">The body.</param>
        /// <returns></returns>
        public static EdmFunction CreateAndAddFunction( this EdmModel item, string name,
            IList<FunctionParameter> parameters, IList<FunctionParameter> returnValues, string body = null )
        {
            var payload = new EdmFunctionPayload
            {
                StoreFunctionName = name,
                Parameters = parameters,
                ReturnParameters = returnValues,
                Schema = item.GetDefaultSchema()
            };

            EdmFunction function = EdmFunction.Create( name, item.GetDefaultNamespace(), item.DataSpace, payload, null );

            item.AddItem( function );

            return function;
        }
Ejemplo n.º 30
0
        public static EdmFunction AddFunction(this EdmModel database, string name, EdmFunctionPayload functionPayload)
        {
            DebugCheck.NotNull(database);
            DebugCheck.NotEmpty(name);

            var uniqueIdentifier = database.Functions.UniquifyName(name);

            var function
                = new EdmFunction(
                    uniqueIdentifier,
                    DefaultStoreNamespace,
                    DataSpace.SSpace,
                    functionPayload);

            database.AddItem(function);

            return function;
        }