Beispiel #1
0
        public Menu ToMenu()
        {
            if (FeatureMenu != null)
            {
                return(FeatureMenu);
            }

            FeatureMenu = Globals.MENU.AddSubMenu(NameFeature, Globals.ADDON_NAME + " - " + NameFeature);
            FeatureMenu.AddGroupLabel(NameFeature + Player.Instance.ChampionName);

            foreach (var valueAbstract in MenuValueStyleList)
            {
                switch (valueAbstract.EnumMenuStyle)
                {
                case EnumMenuStyle.Slider:
                    MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue = ((ValueSlider)valueAbstract).InitialValue;
                    var currentMenuFeatureAxuSlider = FeatureMenu.Add(NameFeature + "." + valueAbstract.Identifier, new Slider(valueAbstract.DisplayName, ((ValueSlider)valueAbstract).InitialValue, ((ValueSlider)valueAbstract).MinValue, ((ValueSlider)valueAbstract).MaxValue));
                    currentMenuFeatureAxuSlider.OnValueChange += delegate(ValueBase <int> sender, ValueBase <int> .ValueChangeArgs args)
                    {
                        MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue
                            =
                                currentMenuFeatureAxuSlider.CurrentValue;
                    };
                    break;

                case EnumMenuStyle.Checkbox:
                    MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue =
                        ((ValueCheckbox)valueAbstract).InitialValue;
                    var currentMenuFeatureAuxCheckbox = FeatureMenu.Add(NameFeature + "." + valueAbstract.Identifier,
                                                                        new CheckBox(valueAbstract.DisplayName, ((ValueCheckbox)valueAbstract).InitialValue));
                    currentMenuFeatureAuxCheckbox.OnValueChange += delegate(ValueBase <bool> sender, ValueBase <bool> .ValueChangeArgs args)
                    {
                        MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue
                            =
                                currentMenuFeatureAuxCheckbox.CurrentValue;
                    };
                    break;

                case EnumMenuStyle.KeyBind:
                    MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue =
                        ((ValueKeybind)valueAbstract).InitialValue;
                    var currentMenuFeatureAuxKeybind = FeatureMenu.Add(NameFeature + "." + valueAbstract.Identifier,
                                                                       new KeyBind(valueAbstract.DisplayName, ((ValueKeybind)valueAbstract).InitialValue, ((ValueKeybind)valueAbstract).BindType));
                    currentMenuFeatureAuxKeybind.OnValueChange +=
                        delegate(ValueBase <bool> sender, ValueBase <bool> .ValueChangeArgs args)
                    {
                        MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue
                            =
                                currentMenuFeatureAuxKeybind.CurrentValue;
                    };
                    break;
                }
            }

            return(FeatureMenu);
        }
Beispiel #2
0
        public Menu ToActivatorMenu()
        {
            if (FeatureMenu != null)
            {
                return(FeatureMenu);
            }

            FeatureMenu = Globals.ACTIVATOR_MENU.AddSubMenu("Activator - " + NameFeature, "Activator - " + NameFeature);
            FeatureMenu.AddGroupLabel("Activator - " + NameFeature);

            foreach (var valueAbstract in MenuValueStyleList)
            {
                if (valueAbstract.SeparatorBefore)
                {
                    FeatureMenu.AddSeparator();
                }

                switch (valueAbstract.EnumMenuStyle)
                {
                case EnumMenuStyle.Slider:
                    MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue = ((ValueSlider)valueAbstract).InitialValue;

                    var currentMenuFeatureAxuSlider = FeatureMenu.Add(NameFeature + "." + valueAbstract.Identifier,
                                                                      new Slider(valueAbstract.DisplayName, ((ValueSlider)valueAbstract).InitialValue, ((ValueSlider)valueAbstract).MinValue, ((ValueSlider)valueAbstract).MaxValue));

                    currentMenuFeatureAxuSlider.OnValueChange += delegate(ValueBase <int> sender, ValueBase <int> .ValueChangeArgs args)
                    {
                        MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue = currentMenuFeatureAxuSlider.CurrentValue;
                    };

                    break;

                case EnumMenuStyle.Checkbox:
                    MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue =
                        ((ValueCheckbox)valueAbstract).InitialValue;

                    var currentMenuFeatureAuxCheckbox = FeatureMenu.Add(NameFeature + "." + valueAbstract.Identifier,
                                                                        new CheckBox(valueAbstract.DisplayName, ((ValueCheckbox)valueAbstract).InitialValue));

                    currentMenuFeatureAuxCheckbox.OnValueChange += delegate(ValueBase <bool> sender, ValueBase <bool> .ValueChangeArgs args)
                    {
                        MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue = currentMenuFeatureAuxCheckbox.CurrentValue;
                    };

                    break;

                case EnumMenuStyle.KeyBind:
                    MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue =
                        ((ValueKeybind)valueAbstract).InitialValue;

                    var currentMenuFeatureAuxKeybind = FeatureMenu.Add(NameFeature + "." + valueAbstract.Identifier, ((ValueKeybind)valueAbstract).Key != '\0' ?
                                                                       new KeyBind(valueAbstract.DisplayName, ((ValueKeybind)valueAbstract).InitialValue, ((ValueKeybind)valueAbstract).BindType, ((ValueKeybind)valueAbstract).Key)
                            : new KeyBind(valueAbstract.DisplayName, ((ValueKeybind)valueAbstract).InitialValue, ((ValueKeybind)valueAbstract).BindType));

                    currentMenuFeatureAuxKeybind.OnValueChange += delegate(ValueBase <bool> sender, ValueBase <bool> .ValueChangeArgs args)
                    {
                        MenuValueStyleList.Find(x => x.Identifier == valueAbstract.Identifier).CurrentValue = currentMenuFeatureAuxKeybind.CurrentValue;
                    };

                    break;
                }
            }

            return(FeatureMenu);
        }