Ensage.Common.Menu.AbilityToggler.Add C# (CSharp) Method

Add() public method

The add.
public Add ( string name, bool defaultValue = true ) : void
name string /// The name. ///
defaultValue bool /// The default value. ///
return void
        public void Add(string name, bool defaultValue = true)
        {
            var textureName = name;
            if (this.Dictionary.ContainsKey(name))
            {
                name += this.random.Next(1, 9);
            }

            if (this.SValuesDictionary.ContainsKey(name))
            {
                defaultValue = this.SValuesDictionary[name];
            }

            this.Dictionary.Add(name, defaultValue);
            if (!Menu.TextureDictionary.ContainsKey(name))
            {
                Menu.TextureDictionary.Add(
                    name,
                    textureName.Substring(0, "item".Length) == "item"
                        ? Textures.GetTexture("materials/ensage_ui/items/" + textureName.Substring("item_".Length) + ".vmat")
                        : Textures.GetTexture("materials/ensage_ui/spellicons/" + textureName + ".vmat"));
            }

            if (!this.SValuesDictionary.ContainsKey(name))
            {
                this.SValuesDictionary.Add(name, defaultValue);
            }

            if (this.PositionDictionary.ContainsKey(name))
            {
                return;
            }

            this.PositionDictionary.Add(name, new float[] { 0, 0 });
        }

Same methods

AbilityToggler::Add ( string name, string textureName, bool defaultValue = true ) : void